How to get all rows from Page list and convert them to CSV utilizing pxConvertResultsToCSV

痴心易碎 提交于 2019-12-25 05:13:46

问题


I have a Repeat grid layout, as a source is Report definition. The grid displays twenty row per page. So, if there are thirty-three rows, there are four pages.

I have got a task to export all grid's data to CSV. I have found out the pxConvertResultsToCSV activity. It requires to pass PageList with the properties to convert. I use pgRepPgSubSectionMySectionListB.pxResults to do this. But I have realized, that the property pxResults contains only first twenty elements of pgRepPgSubSectionMySectionListB. But I must export to CSV all the rows. How can I reach this? Thank you.


回答1:


First run your report by calling pxRetrieveReportData activity of class Rule-Obj-Report-Definition in you acticity

Syntex:- call Rule-Obj-Report-Definition.pxRetrieveReportData

It will ask for parameters:-

pyReportName :- your report definition name

pyReportClass:- class of the report definition

pyPageName :- any page name for example ReportListExport. This page must be defined in Pages & Classes of class Code-Pega-List

After successful execution of this step, you will get ReportListExport.pxResults in Clipboard.

Now use this pxResults for export.


There is one more activity to export your Report in excel.

Call pzViewExportToExcel activity after running your report. And keep ReportListExport.pyReportDefinition as step page of this step.

This is preferred one.




回答2:


This question is a bit old now so I'm sure the OP has probably solved the problem and moved on at this point. But for future viewers there is an easier way to solve this.

Pega includes a gadget called the "Record Editor" which can be used to display a report definition as an editable data table. It shows the provided report definition in a simple table as normal but users can also edit the rows, delete the rows and add new ones. It also includes import and export actions at the top so users can drop the entire resultset being shown in the table to CSV and then re-import changes back in after editing. You can find more information on this gadget and how to use it in this community article

If you simply want to provide an option at the top of a table sourced from a report definition that allows users to export the results as CSV without using the record editor gadget there is an API for that as well. The activity "pxDownloadDataRecordsAsCSV" in class "PegaAccel-Task-DataTableEditor" does this. It accepts the class and name of a report definition as parameters, runs that report and serves up the contents as a CSV file.

The second part here isn't too different from AJ's solution it's just an already existing parameterized activity you can use instead of writing one yourself.



来源:https://stackoverflow.com/questions/43471934/how-to-get-all-rows-from-page-list-and-convert-them-to-csv-utilizing-pxconvertre

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!