ReadCSV Lopp not picking next line from CSV file

Hello,
I am new to automated testing, and am stuck on the test reading the next line in my CSV file. The file has two fields, one a vendor number, the next an email address.
The test picks up the vendor number, will search for it, goes to where I want the email address added, adds it, saves it, then loops through again, but is not picking up line 2, but picking up line 1 again.

The file lay out is

vendor1,vendor1email
vendor2,vendor2emal
vendor3,vendor3email

The source view for my test is

{
  "Name": "Update_no_email_add",
  "CreationDate": "2022-8-18",
  "Commands": [
    {
      "Command": "store",
      "Target": "slow",
      "Value": "!replayspeed",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "88",
      "Value": "loop",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "i",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${i}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "while_v2",
      "Target": "${i} <= ${loop}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "Web link to system to update",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "selectFrame",
      "Target": "id=ptifrmtgtframe",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=#ICCorrectHistory",
      "Value": "Y",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "id=#ICCorrectHistory",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "csvRead",
      "Target": "VendorList.csv",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=VENDOR_AP_VW_VENDOR_ID",
      "Value": "${!COL1}",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "id=#ICSearch",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "link=Address",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=VENDOR_ADDR_EMAILID$0",
      "Value": "${!COL2}",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "id=#ICSave",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return Number (${i}) + 1;",
      "Value": "i",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}

How do I get “${!COL1}” and “${!COL2}” to return the data from my CSV from each row with each pass?

Thanks,
Andrew.

This is a good question. If you do not use the LOOP button but while, you need to manually increase the ${!csvReadLineNumber} variable:

For more details see the DemoCsvReadWithWhile macro that ships with the RPA software.

    {
      "Command": "executeScript_Sandbox",
      "Target": "return Number(${!csvReadLineNumber})+1",
      "Value": "!csvReadLineNumber",
      "Description": "Increase by one to read the next line. "
    },

Test:

1 Like

Thanks for this. Will have a look and update my test.

Thankyou for the update and the video. I was able to work it out and it looks to be working as needed.