Discussion
Pegasystems Inc.
JP
Last activity: 11 Oct 2023 11:15 EDT
How to build downloading CSV file function
Hi,
In this post, I will share how to build downloading CSV file from Page List function using pxConvertResultsToCSV activity. Please see attached for the tutorial.
This document includes the following tips:
- How to give an arbitrary name to the downloaded file
- How to change header name in the CSV file from actual property name
- How to source embedded page (pyWorkPage) and top page (non-case context)
- How to download a full list of top page (non-case context) when using pagination on section
- How to enable Japanese characters (modify "pxConvertResultsToCSV" activity's character set from Unicode to MS932 so you can directly open the CSV file using Japanese Microsoft Excel)
* How to export CSV file from Joined Page List
If you join tables in a Report Definition, your page list will include pxPages() within each pxResults instance, as shown below.
Say, you want to place a button to download a CSV file.
Can we specify pxPages() directly for "pxConvertResultsToCSV" activity without modifying data structure? Yes, we can. For CSVProperties parameter, type something like:
"pyID,.pxPages(Item).Name,.pxPages(Item).Price,pxCreateDateTime"
Enclose the entire string in double quotes, and put dot before pxPages(). A slight difference will cause errors, so pay close attention to syntax.
* Related topic
The usage of all the combinations of upload / download CSV / Excel file is summarized at https://support.pega.com/discussion/handling-files-thru-user-interface.
Hope this helps.
Thanks,