Access a number from a csv and loop a function that number of times?

Hi all,

I want to create a macro that achieves the following:

  • Read {COL1} of a csv (i.e. “8”)
  • Perform a loop that number of times, so in this case, I want the macro to loop 8 times

This is what I have so far. Everything works except it only performs it once and doesn’t loop?

Code so far:

{
  "Name": "incrementing-loop-read-csv ",
  "CreationDate": "2020-5-23",
  "Commands": [
    {
      "Command": "store",
      "Target": "0",
      "Value": "myCounter"
    },
    {
      "Command": "csvRead",
      "Target": "spreadsheetcounter.csv",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "Number ${!COL1}",
      "Value": "numCSV"
    },
    {
      "Command": "echo",
      "Target": "Now starting, current count is ${myCounter}",
      "Value": "green"
    },
    {
      "Command": "echo",
      "Target": "Also, our value pulled from the CSV is: ${numCSV}",
      "Value": "blue"
    },
    {
      "Command": "label",
      "Target": "restartCounter",
      "Value": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return Number (${myCounter})+1",
      "Value": "myCounter"
    },
    {
      "Command": "echo",
      "Target": "Continuing, new count is ${myCounter}",
      "Value": "green"
    },
    {
      "Command": "gotoIf_v2",
      "Target": "${myCounter} < ${numCSV}",
      "Value": "restartCounter"
    }
  ]
}

You can use the new times command it’s easy and fast

Use COL1 value to set the times value

Here there are the example
https://ui.vision/rpa/docs/selenium-ide/times

I actually started writing this macro with the !times command, and then went to do… with no luck lol, would you mind showing me how times would fit into my macro here? Thanks!

HI, I was able to achieve what I was looking for and am now able to have the macro loop a certain number of times, but now echo is returning “true” instead of a number?

Code:

{
  "Name": "incrementing-loop-read-csv ",
  "CreationDate": "2020-5-24",
  "Commands": [
    {
      "Command": "store",
      "Target": "0",
      "Value": "myCounter"
    },
    {
      "Command": "csvRead",
      "Target": "spreadsheetcounter.csv",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "${!COL1}",
      "Value": "numCSV"
    },
    {
      "Command": "echo",
      "Target": "Now starting, current count is ${myCounter}",
      "Value": "green"
    },
    {
      "Command": "echo",
      "Target": "Also, our value pulled from the CSV is: ${numCSV}",
      "Value": "blue"
    },
    {
      "Command": "times",
      "Target": "${!COL1}",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "Continuing, new count is ${myCounter}",
      "Value": "#shownotification"
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return Number (${myCounter})+1",
      "Value": "myCounter"
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "myCounter"
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    }
  ]
}