Why does csvRead reads last line twice?

Hi dear community,

my macro works with a while-loop using csvRead.

My csvfile insertfile contains 20 lines. My problem is that every time i run the macro, the last line is read out twice!

Is there a possibilty to just delet the last csvread-line or avoid csvRead-command to read out twice?

Used commands are the following ones:

-csvRead
-loop content (open|store|etc…)
-csvSave
-End

Thank you in advance for your assistance!

This sounds like some small issue with your while loop, I guess you made a small bug there. => Can you post a test macro here?

The Macro looks like:

  • csvRead | datainput.csv
  • echo | Status = {!csvReadStatus}, line = {!csvReadLineNumber}
  • Open | url including ${!col1} [including reference from datainput.csv]
  • executeScript_Sandbox | regex searching for specific data
  • csvSave | dataoutput.csv
  • while_v2 | ${!csvReadStatus} == “OK”
  • echo | status = {!csvReadStatus}, line = {!csvReadLineNumber}
  • echo | Batch= ${!col1}
  • executeScript_Sandbox | return ${!col1}.split("|") | varArray
  • executeScript_Sandbox | return ${varArray}.length | varLength
  • store | 0 | i
  • while_v2 | {i} < {varLength}
  • executeScript_Sandbox | return Number(${i})+1 | i
  • executeScript_Sandbox | return Number(${!csvReadLineNumber})+1 | !csvReadLineNumber
  • store | true | !errorignore
  • echo | Reading CSV line No. ${!csvReadLineNumber} | !errorignore
  • csvRead | datainput.csv |
  • store | false | !errorignore
  • Open | url including {!col1} [including reference from datainput.csv] | {!COL1}_${!csvReadLineNumber}
  • executeScript_Sandbox | regex searching for specific data
  • csvSave | dataoutput.csv
  • store | true | !errorignore
  • csvRead | datainput.csv
    *store | false |!errorignore
  • end

As a beginner some commands might be superfluous.

I found another solution using commands like csvReadArray and times | ${!CsvReadMaxRow} to loop through my batch file.

Thank you for this great tool!