Reports Pagelet – jQuery and IScripts

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Reporting Pagelet

Reporting Pagelet


How to dynamically display the reports we have created the previous post
using PostReport class to the user? Make it easy to access so that there is minimal training involved.


There are a few people in PeopleSoft community that utilize jQuery to enhance UI in pages and pagelets.Jim Marion has a few articles and even more examples in his book. In this particular case, each user should be able to see quite a few reports – between 4 and 40 by department. I designed a pagelet that shows 1 bar per department, so that when user click on the bar it expands and displays relevant reports.
The first question is how do we get the relevant reports from the Report Manager? We can use the following tables to get the information about the reports that distributed to the user:
CDM_FILELIST_VW – This record is used by Rpt Mgr to store the content list that are viewed via PIA.
CDM_LIST_VW – This view lists all Content to be distributed and all these Content has grant access to one User.
The next question is how to make this pagelet available to the users. I decided to use IScript. IScript allows us the flexibility to produce the entire HTML and JavaScript needed to display the content. When doing so we should remember that IScript needs to be a part of WEBLIB and needs to be added to the permission list:

WEBLIB Permission

WEBLIB Permission

Here is a sample code for IScript_GenerateReportView that is used to generate the content in the Reporting Pagelet you saw above:

/* Generate Reports View for DTARs*/
Function IScript_GenerateReportView

/* Create Rowset that contains all reports for the current user */
      &RS_PAGELET = CreateRowset(Record.ZZ_DTAR_FILE_VW);

/* Add filters to show just PDF and Excel Reports */
      If (&TimeFilter = False) Then
         &RS_PAGELET.Fill("WHERE USERID = :1  AND CDM_FILE_TYPE in ('PDF','XLS') ORDER BY PRCSNAME, DTTM_CREATED  DESC fetch first 400 rows only with ur", %UserId);
         &RS_PAGELET.Fill("WHERE USERID = :1 AND CDM_FILE_TYPE in ('PDF','XLS') AND EXPIRATION_DATE > %DateIn(:2) ORDER BY  PRCSNAME, DTTM_CREATED DESC fetch first 400 rows only  with ur", %UserId, %Date);

      Local string &ReportURL;
      Local string &ReportBody = "";
      Local string &DeptID = "";
      Local string &PrevDeptID = "";
      Local string &Filename = "";
      Local string &ReportDate = "";
      Local integer &ReportYear, &PrevReportYear;
      &MAX_ROWS = &RS_PAGELET.ActiveRowCount;
      &Count = 1;
         While (&Count <= &RS_PAGELET.ActiveRowCount)
            &REC = &RS_PAGELET.GetRow(&Count).GetRecord(Record.ZZ_DTAR_FILE_VW);
            &Filename = &REC.GetField(Field.FILENAME).value;
            &ReportURL = &REC.GetField(Field.URL).Value;
            If (&REC.GetField(Field.CDM_FILE_TYPE).Value = "XLS") Then
			/* Set the Image based on the report Type */
               &REC.GetField(Field.CDM_FILE_TYPE).LabelImage = Image.ZZ_FILE_ICON_EXCEL;
               &ReportBody = &ReportBody | GetHTMLText(HTML.ZZ_DTAR_BODY_HTML, &ReportURL, %Response.GetImageURL(Image.ZZ_FILE_ICON_EXCEL), &Filename, &REC.GetField(Field.DTTM_CREATED).Value);
               &REC.GetField(Field.CDM_FILE_TYPE).LabelImage = Image.ZZ_FILE_ICON_PDF;
               &ReportBody = &ReportBody | GetHTMLText(HTML.ZZ_DTAR_BODY_HTML, &ReportURL, %Response.GetImageURL(Image.ZZ_FILE_ICON_PDF), &Filename, &REC.GetField(Field.DTTM_CREATED).Value);
            &Count = &Count + 1;
         /* Add Header and close body HTML 
		 Image.EOAW_INFO_ICN - image that shows on the bar, and passed to the ZZ_INFO_MESSAGE html
         &strInfoMessage = GetHTMLText(HTML.ZZ_INFO_MESSAGE, MsgGetExplainText(30007, 9, "Message Not Found"), %Response.GetImageURL(Image.EOAW_INFO_ICN));
         %Response.Write(GetHTMLText(HTML.ZZ_DTAR_MAIN_HTML, &strInfoMessage | &ReportBody, &strJqueryURL));


We use the while loop to generate the content that includes links to the reports, names, descriptions etc and generate html using ZZ_DTAR_BODY_HTML object


Once we are done with the loop we pass the content to the HTML wrapper that uses simple jQuery code that allows us to perform the expanding and collapsing of the bars in the pagelet. Here is ZZ_DTAR_MAIN_HTML html object :

DTAR Reports



I hope you enjoy this post and find it useful for your future development efforts.

I really want to know what you think