hexagon logo

Assigning a variable from a variable assignment

Hello I would like to do something like the following but I cannot get it to work and coffee has still to hit my this Friday morning:

Assign - Counter=1
Assign - V1=1
Assign - VCALL="V"+Counter

Now, I would like for VCALL to take the value of 1 instead of the string "V1". Keep in mind that this is a super simplified example but should give the idea of what I am after. I tried these pointer brackets {} but they don't seem to work. Creating a function does not seem to work either. I am getting a string with the name of the variable instead of the value in the variable :S

Any help here guys please?
Parents
  • Hi !
    Not sure to understand what you want to do...

    ASSIGN/COUNTER=1
    ASSIGN/V1=1
    ASSIGN/VCALL=COUNTER+V1​

    In this case, VCALL=2
    Do you want that V1 is the start value, then increment with counter ?


    So I will make the request more complicated (as is) to be more clear:

    I have a loop and assignments as

    V1=3
    V2=5
    v3=1000
    .
    .
    .


    random numbers in general in the variables.

    Within my loop I want to populate a seperate variable lets say VCALL to take the value of the V variables based on the counter of the loop.
    So first run will take the V1 value of 3 meaning VCALL=3. Second run of loop will take VCALL=5 etc.
    How do I achieve this? My mind is blocked :P
  • Rather than having V1, V2 & V3 as separate assignments, you could put the values in an array like this...

          assign/v1=array(3,5,1000)
                assign/counter=0
                do/
                  assign/counter=counter+1
                  assign/vcall=v1[counter]
                  comment/oper,no,full screen=no,auto-continue=no,ovc=no,
                  vcall
                until/counter==3​
    
Reply Children
No Data