Respected Contributor.. hpooStudent Respected Contributor..
Respected Contributor..
563 views

list iterator index

hi i am trying to get the count of the list iterator i can see it in the raw results but not in the output varibles. like to check is there anywat to get the index value. 

Under raw result, there is index = XX

listIterator.png

Do not see index in the selection list. 
listIterator2.png

0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

Re: list iterator index

Hi,

That index output is there strictly for debuging purposes (making it easier to debug lists where items may be duplicated). If you want to also get the index position of the element you can create a quick javascript filter on a result of the iterator to compute it. then assign it as the result.

Regards,

Vlad

0 Likes
Frequent Visitor.. ElioteArg
Frequent Visitor..

Re: list iterator index

And how do I have to call that "index" variable using a scriptlet? I need that value in order to modify a row in an Excel file

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: list iterator index

Hi,

in the case of this the scriptlet is simple:

 

index = scriptletContext.get("index");
if( index == null) { index = 0} else {index = Number(index) + 1};
scriptletContext.put("index",index);

 

Where you should replace the variable name index with whatever suits your needs in order to not confuse it with the operation's index result).  

Regards,

Vlad

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.