Nested Variables or Variables Inside Variables Requested

Hello - I am also wondering if there has been any update or perhaps what the timeline is around supporting variables inside variables e.g. to reference TestVar1 using {TestVar{NumVar}}. I am often working with an unknown number of variables in a loop that I am running so I can’t reference them in my CSV without a nested variable unless someone else knows a workaround.

Thanks!

I need the same checking existence of dynamic variable names!

I can create already a dynamic named variable but I can’t test it if I don’t know the name:

You can have arrays with the execute script command:

In this example we first create the array “a” and then access the 2nd element:

{
  "Name": "array",
  "CreationDate": "2019-10-19",
  "Commands": [
    {
      "Command": "executeScript_Sandbox",
      "Target": "return new Array ('cat','dog','fish','dog','deer','frog','whale','dog','seal','horse','elephant')",
      "Value": "a"
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${a}[2];",
      "Value": "var"
    },
    {
      "Command": "echo",
      "Target": "var=${var}",
      "Value": ""
    }
  ]
}
2 Likes

Hello.

I have learned from your post how to pass an array value to a var but i wonder how to pass variable value into an array position, moreover, id like to modify directly the arrray without using aux vars.

Example i have an array of 10 elements as counters, so the new defined array is like 0,0,0,0,0,0…

I want to increase counters by 1 every time a condition is met, i have now 10 times this:

{
      "Command": "executeScript_Sandbox",
      "Target": "return number ${counter1} + 1;",
      "Value": "counter1"
    },

{
      "Command": "executeScript_Sandbox",
      "Target": "return number ${counter2} + 1;",
      "Value": "counter2"
    },


and wanted to convert into something like:

{
      "Command": "executeScript_Sandbox",
      "Target": "return number ${arrraycounter}[${counter}] + 1;",
      "Value": "arrraycounter[${counter}]"
    },


but it doesnt work, either it gives me an error or dont store the value at all or doesnt store the correct value.

Thanks