How to Remove Items from a Page List in a Data Transform
There are three main approaches to removing elements from a Page list based on specific values
Approach 1: Using For Each Page In with Remove Action
This approach iterates through each page in the list and removes items that match your criteria:
1. Create or open your Data Transform rule.
2. Add a For Each Page In action.
3. Add a When condition inside the For Each action.
4. Inside the condition, set the .pyDeletedObject to true.
5. Call the @RemoveDeletedObject(MyPageList) outside the For Each loop
Note: .OperatorList is a Page List
Approach 2: Creating a New Filtered List (I know this not a 'remove', but the result is a list without the items you wanna remove)
This approach creates a new list with only the items you want to keep:
1. Create or open your Data Transform rule.
2. Add a For Each Page In action.
3. Add a When condition inside the For Each action.
4. Inside the condition, set the current page to a new page list.
Variation: Filter Results Directly on the Source
One variation is to filter the results directly on the source:
1. Select the action Append to.
2. Fill the empty list target and set the relation to each page in.
3. Click the small icon and fill the popup Conditionally Append Source to filter directly in the origin.
Approach 3: Using the Remove Action Directly (For Simple Cases)
For simpler scenarios where you know the exact index of the item to remove:
1. Create or open your Data Transform rule.
2. Add a For Each Page In action.
3. Add a When condition inside the For Each action.
4. Set a parameter with the index to remove inside the condition.
5. Outside the For Each loop, select the remove action and set the target to the list index.
________________________________________
References:
• https://community.pega.com/knowledgebase/articles/data-transform-rule
• https://community.pega.com/knowledgebase/articles/working-page-and-page…
• https://academy.pega.com/topic/data-management