Upload Excel File and Populate the Data into Pagelist
We have a requirement that user can upload an excel file and populate the data from the excel file into pagelist.
The "choose file" button is pxFileUpload and put the file name into .FilePath. The "Upload" button has activity MSOParseExcelFile.
1. When using pxFileUpload, is the .Filepath property only get the name of the file? if yes, where do I can find the file path?
2. How do I can parse the data using MSOParseExcelFile activity and populate it into the pagelist?
I'm not sure what pxFileUpload does but, FilePath control uploads the file and puts the location of the file in the server(in service export directory, complete path).
You can use FilePath control which keeps the path in pxRequestor.pyFileUpload property, which we can pass to MSOParseExcelFile activity.
Coming to MSOParseExcelFile usage, you'll have to create a template first in Pega which contains how the values are to be parsed and into what positions of the page list. This template needs to be used as a parameter to the activity.
Please go through existing templates(this would be an RFB rule-file-binary) like "excel!PAProjectSizing_Read!xlsx" for more information about templates.
When using pxFileUpload, is the .Filepath property only get the name of the file? if yes, where do I can find the file path?
Review the activity/clipboard pages for file details. It usually gets created under pyAttachments(Pagelist) of pyWorkPage of the work object or pyAttachmentPage (top-level page among User Pages on the clipboard).
Though, when a file is uploaded from local action, pxRequestor.pyFileUpload is updated. And uploaded file is placed under ServiceExport directory of the server. For ex:
Alternatively, you can use "FilePath" control as well.
To upload a single file: 1. Drag a property to your section 2. Use "FilePath" as Html Property 3. Add "ONCHANGE" Behavior and refer the "SaveUploadedFile" activity. 4. Check the activity/clipboard pages to get file details. Ideally, a new page gets created "pyMultipleFilesPage" under which a page-list "pyFileAttachment" will get appended based on the uploaded file.
You can refer "pzUploadRequirementsExcel" and "pzExcelValidateAndUploadRequirement" activity of Pega-AppDefinition ruleset. There is the OOTB implementation of uploading and validating the file, also checking for viruses if any.