I have always wondered why PeopleSoft never included a "Download All" button in all their releases for Report Manager.
Of course, messing with delivered objects is generally frowned upon.
But if you really wanted to implement one, here's a sample.
Local Rowset &RSReports;
&RSReports = GetRowset(Scroll.CDM_LIST_VW);
/* Count how many files were selected */
&Selected = 0;
For &i = 1 To &RSReports.ActiveRowCount
If &RSReports(&i).CDM_WRK.DELETE_FLAG.Value = "1" And
All(&RSReports(&i).CDM_LIST_VW.CONTENTID.Value) Then
&Selected = &Selected + 1;
End-If;
End-For;
If All(&Selected) Then
/* Always nice to ask users */
&Response = MessageBox(%MsgStyle_OKCancel, "", 0, 0, "Are you sure you want to download %1 report(s)?", &Selected);
If &Response = %MsgResult_OK Then
&Selected = 0;
/* Loop through the rowset and download every file */
For &i = 1 To &RSReports.ActiveRowCount
If &RSReports(&i).CDM_WRK.DELETE_FLAG.Value = "1" And
All(&RSReports(&i).CDM_LIST_VW.CONTENTID.Value) Then
SQLExec("SELECT FILENAME FROM PS_CDM_FILELIST_VW WHERE PRCSINSTANCE = :1 AND CONTENTID = :2", &RSReports(&i).CDM_LIST_VW.PRCSINSTANCE.Value, &RSReports(&i).CDM_LIST_VW.CONTENTID.Value, &Filename);
ViewContentURL(&RSReports(&i).CDM_LIST_VW.URL.Value | "/" | &RSReports(&i).CDM_LIST_VW.CONTENTID.Value | "/" | &Filename);
&Selected = &Selected + 1;
End-If;
End-For;
/* Summary report */
If &Selected > 0 Then
MessageBox(0, "", 0, 0, "Downloaded " | &Selected | " report(s).");
End-If;
End-If;
End-If;
Add this to a pushbutton FieldChange event on the page and you are good to go.
This can be further improved by putting each file in zipped format but that is a discussion for another day.
No comments:
Post a Comment