How to create a loop in HPOO
I need to create a loop/while that given a variable (numberOfServers) it prints once the name of the servers.
For example, in pseudo code:
numberOfServers = 2 serverName =  while count <= numberOfServers: serverName.append('stageServer' + count) count += 1 print (serverName)
Is it possible to do something like this with flows?
Not sure if mine is the most efficient but
1) to get the number, use an Addition while storing the output as a variable. (this will give you your count)
2) use Set Flow Variable to create an empty variable.
3) try using a List Iterator (delimited using perhaps a ',') to go through your array and store the output together with the count via List Appender
4) after appending via List Appender, use Addition again to increase your count by 1
I'm not very sure if step 3 will work for you because my usage was to go through a whole folder but theoretically I believe its sound.
There are multiple ways you can approach it. Look in Utility Opertions at lists and Looping and Math and Comparison
If you already have a list, you can use the the list iterator which will keep track of the number and perform the action on each item. If you are building a list but only want a certain size, then you would 1.) set an empty flow variable (example listCount) 2.) list appender 3.) peform action 4.) use Equal to check the listCount against a threshold if equal, bail if not go back to list appender, etc..
Or if you have a list, you can grab the last item and cycle through similar to above.
Thanks guys, I will follow the idea of the list.
But I have one more question. I save/create multiple variables on one Do Nothing step, how can I save on the list?Or its possible to save it altogether?
For example, in the Do Nothing step I have:
hostName1=daniel1 hostIP1=127.0.0.1 hostName2=daniel2 hostIP2=127.0.0.2 hostName3=daniel3 hostIP3=127.0.0.3
Is there any way to add those 3 variables at the same time to the list?