@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:
-
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.
-
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.
-
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.
-
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.