Question
Verizon
US
Last activity: 7 Mar 2023 4:29 EST
How to convert string param to pagelist or path reference
I have a pagelist path in param as a string, but for StringCSVFromPagelist function which accepts 2 params - 1 as pagelist and another as property, but this function isnt accepting pagelist path as param here actually I need to pass pagelist and respective property dynamically so using param for pagelist and property but this doesnt seems working for pagelist though param is working for property, need your help on how to convert string param to path reference or pagelist.
For Ex: @Default.StringCSVFromPageList(Param.Pagelist,Param.Property)
Scenario 1: Param.Pagelist=pyWorkPage.XYZ.ABC() and property is .D
Scenario 2: Param.Pagelist=pyWorkPage.XYZ.PQR() and property is .S
Scenario 3: Param.Pagelist=pyWorkPage.XYZ.EFG() and property is .H
Scenario 4., so on and so forth..
How to dynamically pass this pagelist to StringCSVPagelist function to fetch comma separated values, as the function isnt accepting param as pagelist.
Any suggestions would be highly appreciated.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 7 Mar 2023 4:15 EST
Verizon
US
Thank you all, I got the answer for this as: @pxGetProperty(Param.Pagelist,Param.Property,true) - this is getting me the pagelist path or reference in clipboard from the string params.
Bits in Glass
IN
@naras9 that parameter accepts only pagelist structure it seems. You can dynamically set your pyworkpage. Pagelist to a tempage. Pagelist and pass that to this function. So whichever pagelist you want to pass to this function you can set it to temppage.pagelist and this will be available in all the context for usage. Once processing is done you can remove this temppage.
Updated: 1 Mar 2023 0:21 EST
Verizon
US
@Anoop Krishna Thanks for the prompt response, but the temppage.pagelist isnt working actually pagelist is dynamic value here so that pagelist is in another parameter.
-
Anoop Krishna
Wipro
US
@Sowmya_Narahari In that case, you can try using the Param.Reference function to convert the string parameter into a pagelist reference. For example:
- Create a data transform that sets the pagelist reference to a property, like this: Param.Reference(Param.Pagelist)
- Pass the property name to the StringCSVFromPageList function, like this: @Default.StringCSVFromPageList(.PageListRef, Param.Property)
This should allow you to pass a dynamic pagelist reference to the function. Let me know if this helps or if you have any further questions.
Verizon
US
@RishabR16722312 Sure thanks, let me try this way and will update you if it works.
Wipro
US
@Sowmya_Narahari No problem! Just doing my best to help.
Bits in Glass
IN
@Sowmya_Narahari you will have to set pagelist property name to a param right, in the same place if you set the pagelist property to temp. Pagelist, won't it work?
Verizon
US
@Anoop Krishna I have pagelist in string format i.e., Param.Pagelist = pyWorkPage.XYZ.ABC but its not pagelist format, if its a pagelist property i dont need anything else, as the pagelist is built and stored in parameter in the string format, I'm in need of converting it to a pagelist now. So when its in string format how to convert into pagelist is my question.
Updated: 1 Mar 2023 8:48 EST
Bits in Glass
IN
@Sowmya_Narahari Ok fine, can you tell me what is the reason behind setting it to a param value? This was my understanding. You are looping over all the pagelist, and you want to extract csv of all those pagelists. So for that you are looping all the pagelists, setting it to param.Value and passing it to this csvextract function. Also when setting pagelist to param, you said its getting stored as string. Can you show me how param is storing pagelist as a string?
Verizon
US
@Anoop Krishna no that not the scenario! as I stated earlier I'm comparing two entities and LHS is from current entity where based on few fields I'm getting pagelist value dynamically, and in another entity i.e., RHS I already have build comma separated string for each pagelist in runtime of that entity. So for LHS comma separated values as I have pagelist value dynamically I'm setting it into param and tried to pass to StringCSVFromPageList function which isnt accepting string param as first or pagelist parameter. Hope you got my scenario now.
-
Anoop Krishna
Updated: 1 Mar 2023 9:24 EST
Bits in Glass
IN
@Sowmya_Narahari Okk Got it now. When you are setting a pagelist prop to a param, how is it getting stored in Param? I am curios to know how a Param of string type stores a list of pages. Anyway you are trying to convert it to csv using function, instead of that, what if you are looping the pages of that pageslist and form csv string yourselves? Or setting of pagelist prop to param is mandatorily required in your scenario?
Infomatics Corp
US
@Sowmya_Narahari As the function accepts the first Parameter to be of Pega Data Type ClipboardProperty and second parameter is a string. When you pass parameter it is not the actual reference of the clipboard Property. Where are you calling this function what is the need of setting the Property reference name in string? Can that not be accessible using step page
Updated: 1 Mar 2023 0:12 EST
Verizon
US
@Abhilash_K No its not accessible using steppage as the pagelist is passed dynamically based on few other selections, so I'm building this pagelist path for comparison of LHS value with a RHS value, where I have RHS value a string with comma separated values, this is actually used in entity comparison where the current entity is considered in LHS, so for LHS value now passing dynamic pagelist and its respective property to fetch comma separated string using StringCSVPageList function and then compare those two comma separated strings based on operator.
Wipro
US
@naras9 Thank you for the clarification your provided on your latest response. I understand that you are dynamically passing the Pagelist property based on other selections and using the path reference to compare the values in the Pagelist with a comma-separated string on the right-hand side.
In this case, you can still use the path reference I mentioned earlier to access the child property within the Pagelist dynamically. You would just need to replace the "PageName" with the property reference that corresponds to the dynamic Pagelist property.
For example, if you have a dynamic Pagelist property called "pyWorkPage.OrderItems" and you want to access the "Quantity" property of the second row, you could use the following path reference:
pyWorkPage.OrderItems(<row index>).Quantity
Where "<row index>" is the index of the row in the Pagelist that you want to access.
Once you have retrieved the comma-separated string for the dynamic Pagelist using the "StringCSVPageList" function, you can compare it with the comma-separated string on the right-hand side using the desired operator.
I hope that helps!
Wipro
US
@naras9 To convert a string parameter to a pagelist or path reference in Pega, you can use the tools available in the Pega platform.
First, you can use the Page-Name method to retrieve the page reference for the pagelist. For example, if your pagelist path is stored as a string in the parameter "Param.Pagelist", you can retrieve the page reference using the following expression:
@Page-Name(Param.Pagelist)
This will return a page reference for the specified pagelist path.
Next, you can use the Property-Reference method to retrieve the property reference for the property you want to reference. For example, if your property name is stored as a string in the parameter "Param.Property", you can retrieve the property reference using the following expression:
@Property-Reference(Param.Property)
This will return a property reference for the specified property name.
Finally, you can use the StringCSVFromPageList function to retrieve the comma-separated values from the pagelist. You can use the page reference and property reference retrieved above as the parameters for this function. Here is an example expression that uses these methods to retrieve the comma-separated values:
@Default.StringCSVFromPageList(@Page-Name(Param.PageList), @Property-Reference(Param.Property))
@naras9 To convert a string parameter to a pagelist or path reference in Pega, you can use the tools available in the Pega platform.
First, you can use the Page-Name method to retrieve the page reference for the pagelist. For example, if your pagelist path is stored as a string in the parameter "Param.Pagelist", you can retrieve the page reference using the following expression:
@Page-Name(Param.Pagelist)
This will return a page reference for the specified pagelist path.
Next, you can use the Property-Reference method to retrieve the property reference for the property you want to reference. For example, if your property name is stored as a string in the parameter "Param.Property", you can retrieve the property reference using the following expression:
@Property-Reference(Param.Property)
This will return a property reference for the specified property name.
Finally, you can use the StringCSVFromPageList function to retrieve the comma-separated values from the pagelist. You can use the page reference and property reference retrieved above as the parameters for this function. Here is an example expression that uses these methods to retrieve the comma-separated values:
@Default.StringCSVFromPageList(@Page-Name(Param.PageList), @Property-Reference(Param.Property))
To test this functionality, you can create test cases that include a variety of different pagelist paths and property names. You can also include test data that covers different data types and formats within the pagelist. For example:
User Story:
As a user, I want to retrieve the comma-separated values from a pagelist, where the pagelist path and property name are specified as string parameters.
Acceptance Criteria:
- Given a valid pagelist path and property name as string parameters
- When the StringCSVFromPageList function is called with the pagelist and property references obtained from the string parameters
- Then the function should return the expected comma-separated values as a string.
Test Case 1:
- Input: Param.PageList = "Page1.List1()", Param.Property = ".Property1"
- Expected Output: "Value1,Value2,Value3"
Test Case 2:
- Input: Param.PageList = "Page2.List2()", Param.Property = ".Property2"
- Expected Output = "ValueA,ValueB,ValueC"
Test Case 3:
- Input: Param.PageList = "Page3.List3()", Param.Property = ".Property3"
- Expected Output = "123,456,789"
To automate the testing of these test cases, you can create automated test scripts using Pega's Automated Unit Test (AUT) framework. This framework allows you to automate the execution of test cases and capture the results for analysis and reporting.
Pagelist Paths: In Pega, a pagelist path refers to the hierarchical reference to a specific page or set of pages in the clipboard. A pagelist is a collection of pages that share the same data structure, and a pagelist path can be used to identify a specific page within that collection.
For example, if you have a pagelist called "MyList" with three pages, you could reference the first page in the list using the path "MyList(1)". This path specifies the pagelist "MyList" and the index "1" to reference the first page in the list.
Pagelist paths are commonly used in Pega to retrieve or update data within a specific page or set of pages, and can be used in conjunction with functions like StringCSVFromPageList to extract data from the pages in a pagelist.
Few more examples of pagelist paths in Pega:
1. `pyWorkPage.ItemsList(1)` - This is a pagelist path that refers to the second item (index 1) in the `Items List` pagelist property on the `pyWorkPage` page.
2. `Page1.SubPage(2).SubSubPage` - This is a pagelist path that refers to the `SubSubPage` property on the third page (index 2) in the `SubPage` pagelist property on the `pyWorkPage` page.
3. `pyWorkPage.Details(3).Address` - This is a pagelist path that refers to the `Address` property on the fourth page (index 3) in the `Details` pagelist property on the `pyWorkPage` page.
4. `Page1.PropList(5).PageProp.Property` - This is a pagelist path that refers to the `Property` property on the `PageProp` page on the sixth page (index 5) in the `PropList` pagelist property on the `Page1` page.
In each of these examples, the pagelist path is used to navigate to a specific page within a pagelist property, using the index of the page within the pagelist.
Verizon
US
@RishabR16722312 Thank you Rishabh for your time, but there isnt any Page-Name method but we have Page-Rename method, and I need path reference only for Pagelist, but for property it is accepted as is in param by "StringCSVFromPageList" function as second param, so I dont think any need of Property-Reference method.
Wipro
US
@naras9 You are correct that there is no Page-Name method in Pega, and for accessing properties within a Pagelist, you can use the following path reference:
PageName(<PageListProperty>). <PropertyName>
Example:
Let's say you have a Pagelist property called "OrderItems" with child properties called "Product" and "Quantity." To access the "Quantity" property of the second row of the "OrderItems" Pagelist, you would use the following path reference:
PageName(OrderItems)(2).Quantity
This path reference specifies the name of the Pagelist property, "OrderItems", and the index of the row, "(2)", followed by the name of the child property, "Quantity."
I hope that helps clarify the usage of path references in Pega! Let me know if you have any other questions.
Wipro
US
@Sowmya_Narahari Alternative suggestion in case what I have mentioned does not work or if you have not found a solution by now:
To convert the string parameter to a path reference for the Pagelist property, you can also try using the "Tools.findPage()" method in Pega. This method takes a string as input and returns a Pega object that corresponds to the specified path reference. This is in fact another effective way to convert a Pagelist path string parameter to a path reference for the "StringCSVFromPageList" function in Pega.
Using the the "Tools.findPage()" method allows you to dynamically pass the Pagelist path as a string parameter and convert it to a path reference at runtime, which is then passed to the "StringCSVFromPageList" function along with the child property name. This approach is flexible and can handle a wide range of dynamic scenarios where the Pagelist path may change based on different conditions or inputs.
For example, to dynamically pass the Pagelist property "py.WorkPage.XYZ.ABC()" to the "StringCSVFromPageList" function, you could use the following code:
@Default.StringCSVFromPageList(Tools.findPage(Param.Pagelist), "D")
Here, the "Tools.findPage()" method is used to convert the string parameter "pyWorkPage.XYZ.ABC()" to a path reference, which is then passed to the "StringCSVFromPageList" function along with the child property "D".
@Sowmya_Narahari Alternative suggestion in case what I have mentioned does not work or if you have not found a solution by now:
To convert the string parameter to a path reference for the Pagelist property, you can also try using the "Tools.findPage()" method in Pega. This method takes a string as input and returns a Pega object that corresponds to the specified path reference. This is in fact another effective way to convert a Pagelist path string parameter to a path reference for the "StringCSVFromPageList" function in Pega.
Using the the "Tools.findPage()" method allows you to dynamically pass the Pagelist path as a string parameter and convert it to a path reference at runtime, which is then passed to the "StringCSVFromPageList" function along with the child property name. This approach is flexible and can handle a wide range of dynamic scenarios where the Pagelist path may change based on different conditions or inputs.
For example, to dynamically pass the Pagelist property "py.WorkPage.XYZ.ABC()" to the "StringCSVFromPageList" function, you could use the following code:
@Default.StringCSVFromPageList(Tools.findPage(Param.Pagelist), "D")
Here, the "Tools.findPage()" method is used to convert the string parameter "pyWorkPage.XYZ.ABC()" to a path reference, which is then passed to the "StringCSVFromPageList" function along with the child property "D".
Similarly, you can use the "Tools.findPage()" method to dynamically pass the Pagelist and property for Scenarios 2,3, and so on.
Overall, this is a good approach and aligns with best practices for dynamic property reference in Pega. It's always important to thoroughly test any code in your Pega environment to ensure that it meets your specific needs and requirements, and to follow best practices and guidelines specific to your project and organization.
My approaches may or may not be aligned with certain guidelines but I hope this provides some assistance to the use cases you are seeking to tackle. Glad to help and if you have additional information, I would be happy to provide support.
https://support.pega.com/question/how-use-toolsfindpage-function
Accepted Solution
Updated: 7 Mar 2023 4:15 EST
Verizon
US
Thank you all, I got the answer for this as: @pxGetProperty(Param.Pagelist,Param.Property,true) - this is getting me the pagelist path or reference in clipboard from the string params.
-
Anoop Krishna Rishab Rege
Bits in Glass
IN
@Sowmya_Narahari You are getting the pagelist reference using @pxGetProperty(Param.Pagelist,Param.Property,true) , that is @pxGetProperty(Param.Pagelist,pyWorkPage.XYZ.ABC,true),
then you are doing this @Default.StringCSVFromPageList(Param.Pagelist,.D)...
.D will have abc,bcs,edc .... My understanding is correct?