Daniel Super Contributor.
Super Contributor.
465 views

Variable composition

I need to call the value of a variable using 2 different variables.

For example in this pseudo code:

instanceNumber=3
instance1="server1"
instance2="server2"
instance3="server3"

count=1
while count >= instanceNumber:
    instanceServer = 'instance' + count
    execute and action with instance
    count += 1

In the image below you can see the flow I'm trying to create.

I have tried to do

- instance${count}

- ${'instance'${count}}

variableComposition.png

 

0 Likes
5 Replies
David_Teh Respected Contributor.
Respected Contributor.

Re: Variable composition

Did you try + ? Point to note is that I stored mine in a variable as I was adding in the output from a subflow to a constant

0 Likes
Respected Contributor.. thisamu Respected Contributor..
Respected Contributor..

Re: Variable composition

Did you tried to use the "Flow Variable Resolver" operation?

 

Micro Focus Expert
Micro Focus Expert

Re: Variable composition

Hi Daniel,

Did you manage to solve this issue?

Lucian

0 Likes
AndreiTruta Outstanding Contributor.
Outstanding Contributor.

Re: Variable composition

You can take the resultString from your loop which will be 1,2,3 and so on to compose the instance${resultString} on your remote command step while instance1 and instance2 and so on are already defined variables within your flow.

Screenshot_54.pngScreenshot_53.pngScreenshot_52.png

 

Andrei Vasile Truta
0 Likes
Daniel Super Contributor.
Super Contributor.

Re: Variable composition

I couldn't find a way to compose a variable, so I end up up using a loop.

First I use the List Appender to save everything on a list and the a List Size with a List Iterator and a counter. The list size give me the "size of the list", then go through the List with the iterator and finally use the counter to get the number I need till the en of the "size of the list".

I create the summary of the installation o "Do nothing", save all the new information o new list and finally on another flow I print the new list.

Its a bit convoluted, but it works

loop.png

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.