Posted: 25 Sep 2018 3:17 EDT Last activity: 17 Feb 2021 10:12 EST
How to create a CSV file out of Report Definition
I have a grid whose source is Report Definition. Requirement is to have a button where user can click to create and download a CSV file from this grid. Filtering must be reflected for generated CSV file.
Let's assume below use case:
- The report definition is to obtain the list of Customers (class: MyCo-MyApp-Data-Customer)
- It seems Pega creates a top page "pgRepPgSubSectionDownloadCustomerBB" and its pxResults(1) to (n) have a list of customers
- I want to specify some property - CustID, Name, PhoneNumber, and Address.
I have located an out-of-the-box activity called "pxConvertResultsToCSV" which seems a best fit for this requirements - however I am not sure what exactly I should enter parameters. Could someone advise me what to actually enter based on above sample page / property name?
If you open the pxConvertResultsToCSV and goto the parameters tab you can see a description of each parameter.
I was able to get this working using just the following parameters:
CSVColumns CSV of properties as columns in CSV
PageListProperty name of the property to be read in the primay page (In the case of a repor definition as above you would need to use the pxResults page)
FileName option. If blank will be defaulted to ResultsToCSV
This is based on a grid sourced from the report Data-Admin-Operator-ID pxRetrieveAllOperators, and I want to export just the properties pyUserName and pxUpdateDateTime.
Note, that this will export all data and not take filters into account. That would be much harder to achieve (and i think would require a custom activity to check the filter criteria), and since excel has it's own filtering tools you are probably better off doing the filtering in excel.