Discussion
Accolite Digital India private Limited
IN
Last activity: 10 Sep 2024 7:16 EDT
How to convert a Pagelist to text file? Each page record should appear in a separate line in text file and place it in repository.
This implementation I have done in two ways:
Approach 1:
a) I have browsed the data from DB table. [Here you can also use DT or DPage or Report Definition]
b) Loop thru each embedded page in pxResults.
c) Under the loop add step "property-set" and add below code:
Primary.EmpResData = Primary.EmpResData + .EmpID + " , " + .EmpName + " , " + .EmpDep + " , " + .EmpSal + "\n"
NOTE : Here in place of "Primary.EmpResData", you can take "param.xyz" or "Local variable"
d) In Pages & Classes :
D_pxNewFile = Embed-Repository-File
e) Add "property-set" out of the loop & in step page give "D_pxNewFile " then add below code:
.pyContents = @pxBase64Encode(Primary.EmpResData)
f) Take method called "Save-DataPage" and expand :
DataPage = D_pxNewFile
repositoryName = "MentionYourRepositoryName"
filePath = "MentionYourFilePathWhereYouWantToCreateFileInSideRepository"
Approach 2:
This approach also will be same as above only changes required in step "c"
c) use "Map-Structured" method and expand:
Direction : Map From Clipboard To Property
Map : Create one map structured rule where you have to mention all columns of a table which you want to fetch (column name will be map in Property, In Offset and Length you have to mention the required space for that particular property "you can check PDN for how to create it ")
Property : Param.XYZ
Now add another step below under loop and add method "Property-Set" :
Param.EmpData = Param.EmpData+Param.XYZ+"\r\n"
NOTE: All other steps will be same as above.