Support Article
Getting index from PageList property by Declare Expression
SA-13164
Summary
There is a requirement to to get index from PageList property by other property value by Declare Expression.
For example,
pyWorkPage has the PageList Property, AAAList, that has 5 items, and Property, KeyCode, that is the unique key as below.
pyWorkPage.AAAList(1).KeyCode = '001'
pyWorkPage.AAAList(2).KeyCode = '200'
pyWorkPage.AAAList(3).KeyCode = '304'
pyWorkPage.AAAList(4).KeyCode = '405'
pyWorkPage.AAAList(5).KeyCode = '501'
And there is other Property, Key, to which the user input values.
When user input '001' in it, get index 1 by Declare Expression. When user input '405' in it, get index 4.
Is it possible to get index from PageList Property in DeclareExpression?
Resolution
Using this in declare expression needs to be done via backward chaining as "whenever used".
@(Pega-RULES:Utilities).IndexInPageList("A", "a1", pyWorkPage.MyAddress)
Here, pyWorkPage.MyAddress is the page list name. A, is the property value to be looked for and a1 is the property which will hold the above value.
In this function, the value to look for is a string reference, A1 and not a property reference. Here, use a sub function to fetch the clipboard property value and pass to this function.
Published August 20, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.