Posted: 9 Jun 2017 6:59 EDT Last activity: 12 Jun 2017 3:56 EDT
Index Property for a nested For Loop in Data Transform
I am facing an issue in getting the pyForEachCount for the Inner For Loop in a data transform which I need for a duplicate check logic.
Let me explain my requirement. I have a list of more than 30 offers and this list size can increase or decrease. All the offers are different.
I have to capture 10 random and unique offers in another Page List. I have written a custom function for the Random Number generation which takes a range and generates the random number. I am iterating through the D_OfferList which is loaded with all the offer details.
But I am stuck in the duplicate check logic. I have tried something but at the set step(18.104.22.168.1) of the inner For Loop I want to decrease the value of the pyForEachCount of the outer loop by 1. On Running the above DT, I am able to get 10 offers but some are repeated, hence the duplicate check is not working.I am not sure how to get hold of the index of the outer loop.
I have enclosed the screenshot of the data transform also.
Please help and suggest what other ways can this be handled.
In step 1.1 use @(Pega-RULES:Utilities).IsInPageList("Test offer", .OfferID, Primary.OfferIndexList) function to check the OfferIndexList has the value, If no then continue to next steps else ignored and move to next iteration of D_OfferList.pxResults.