Question
Capgemini
MX
Last activity: 4 Dec 2022 21:42 EST
How to save data from an excel (xlsx) file to a data type?
So far, I can store the data from a parsed Excel file in a page list that points to a data type, but I would like to save that data to the data type. How do I do it?
The Excel file is parsed using the pxParseExcelFile activity, and I save the fields in a page list with the properties that correspond to each column, and display them in a table.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
JPMC
IN
@EdgarIvanV You would need to loop over the pagelist and do an obj-save on each record and finally do a commit if the activity is being run standalone.
Capgemini
MX
@BhanuPrakash_G Hello, thanks for answering. I tried as below but it gives me this error could you please tell me what am I doing wrong? please i am new to PEGA
JPMC
IN
@EdgarIvanV You can try these two approaches
1. In Pages & Classes set the FamilyData.pxResults to the Data class (eg.., Org-App-Data-xyz) where the results needs to be persisted/saved
2. Loop over the FailyData.pxResults and set the pxObjClass to the Data class where the results needs to be persisted/saved
NCS Pte. Ltd
SG
Hi @EdgarIvanV: If i get this correctly, you have a page list and you need to loop it and save records to a Data type. If this is the case, you can prepare the data and save it using obj-save method in the loop (I could also see that you are performing a loop). You can also try to use OOTB activity like SaveRecord or Save-Page to do save.
If the actual request is to upload data from a file to a data type, check if delegating the data type helps. This will help you to avoid all additional works.
Thanks
Capgemini
MX
@ArulDevan Hello, thanks for answering. I tried as below but it gives me this error could you please tell me what am I doing wrong? please i am new to PEGA
NCS Pte. Ltd
SG
Hi @EdgarIvanV: Error message says that pxobjClass property value is not available. Can you validate it? System needs Pxobjclass property to identify which table it needs to store the data.
Thanks.
Capgemini
MX
@ArulDevan Indeed, the pxobjClass property value is not available.
I tried with this configuration and I get the same error.
Updated: 2 Dec 2022 4:01 EST
Pegasystems Inc.
IN
@EdgarIvanV Hi, Can you please use Primary.FamilyDataList(<APPEND>).CURP which is your first PropertiesName and from the second PropertiesName use Primary.FamilyDataList(<LAST>). When you are trying to create a new pagelist, use APPEND so that the system creates a new Page with pxObjClass that you have mentioned in the Pages and classes. Since you are using current the system did not create a page and pxobjclass is empty.
Note: You are using two different lists (one is FamilyDataList.pxResults-to which you are appending the data and FamilyData.pxResults in which you have the results from excel) so define both the lists in the pages and classes.
Also it is not a best practice to do a obj-save with write-now inside the loop, use a deferred save after the property set and then commit after the loop is over if it is a standalone activity where the pega conventional commit doesnt take place. Please do check the ootb activities that @ArulDevan has already mentioned above instead of commit.
-
Ramesh Reddy Battini
Capgemini
MX
@SrinidhiM Hi, I called the Save-Page activity, but I get this error
NCS Pte. Ltd
SG
Hi @EdgarIvanV: Again the issue here is, you are trying to call a save page from a page list context. You need to call the save action within the loop. Within the loop, make sure that the step page in the step where you perform save action should have values with right pxobjclass in it.
In the tracer add DB Query so that you will get better understanding on what SQL is getting triggered from PEGA.
Thanks.