This is a simple POC, how we can upload an Excel file into Pega and then parse it and display the results in a tabular format in a section.
Lets start !!!
Login to Pega PE 8.5.1
- Create a Data table to get the Page with property
- Create a case type
- Create a binary file for the Excel file to upload
- Create an activity to parse the excel
- Create a section to display the data
Data type with 3 columns (Col1, Col2, Col3)
Create a case type
Take a text input – then change it to FilePath
Go to other and then type FilePath– you will get the control
SetEncodingNow – checked
pySetValueFromFileName – pyFilePath
Create a binary file rule
Save the binary rule.
Now lets create the activity to fetch the Excel file — As of now we have uploaded the binary file that is we told the system what kind of file I will upload.
Now lets write the activity
FileContent is the new page to hold the data
Param.FilePath = pxRequestor.pyFileUpload — in the clipborad we can see that when we upload a file with FilePath control the the FilePath is saved in that path.
In step 3 use the step page as FileContent to hold the data–in clipboard will see the data in that page.
TemplateRFB = webwb!TemplateFile!xlsx
We need to show the data on a screen. So we have to send the data from FileContent page (This is a local page created as part of this activity) to a pagelist. FileContentList.
FileContentList pagelist should be of the same data class of FileContent.
For using in utility shape we should make the activity as utility
Without using the utility shape we can call the activity in the postprocessing of the flowaction.
Now lets see the flow again,
After the utility we have the Show Data screen.
So lets design the section
In Table 1.1 call FileContentList — which is full of data as per the activity.
Now update the columns
Now add the value .Col1 in the Data Type ExcelFileData
In presentation tab make it editable
If we select editable then after the data is available on the screen then user can edit it.
Check the Data Type columns — Col1, Col2, Col3
Now let’s Test it…..
Save and Run
Upload the excel file containing the data.
Hope you liked the article. It is quite simple and I hope you can clearly explain these steps in the next interview. Please try by yourself and then you will get more confidence.
Please do let me know your inputs in the comment box.