[error] Internal variable "!COLx" not supported - how to avoid CSV read error?

A link to source ticket ^^^^

Based on that idea i implemented cycle reading the file, but i am stuck in this moment:
when !COLx is pointing to not existing element, it breaks the macro, and !errorIgnore doesn’t help.
I was expecting !errorignore avoids this error and i can go further, but no =)
I tried store and storeEval commands, same result.

Here is a screenshot: http://i.prntscr.com/JPEVGh62QuihN5hzEaMuLw.png

sample CSV lines:
Propriétaire,QR,Non,Non-applicable,Non-applicable,Non-applicable,
Propriétaire,SICA,Non-applicable,Non-applicable,Non-applicable,Non-applicable,
Courtier,SICA,Non-applicable,Non-applicable,Non-applicable,Non-applicable,

And actually macro:

Macro

{
“CreationDate”: “2018-8-20”,
“Commands”: [

{
  "Command": "csvRead",
  "Target": "rules_list_source.csv",
  "Value": ""
},
{
  "Command": "store",
  "Target": "0",
  "Value": "GLOBAL_COL"
},
{
  "Command": "comment",
  "Target": "switch between variants",
  "Value": ""
},
{
  "Command": "label",
  "Target": "COL_COUNTER",
  "Value": ""
},
{
  "Command": "storeEval",
  "Target": "${GLOBAL_COL}+1",
  "Value": "GLOBAL_COL"
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 1",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "${!COL1}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 2",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "${!COL2}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 3",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "${!COL3}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 4",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "${!COL4}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 5",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "${!COL5}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 6",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "${!COL6}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 7",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "${!COL7}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 8",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "storeEval",
  "Target": "${!COL8}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "while",
  "Target": "${GLOBAL_COL} == 9",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "${!COL9}",
  "Value": "GLOBAL_TEMP"
},
{
  "Command": "if",
  "Target": "${!statusOK} == false",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""
},
{
  "Command": "label",
  "Target": "END_of_LINE",
  "Value": ""
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!statusOK"
},
{
  "Command": "store",
  "Target": "true",
  "Value": "!errorIgnore"
},
{
  "Command": "store",
  "Target": "1",
  "Value": "GLOBAL_COL"
},
{
  "Command": "storeEval",
  "Target": "${!csvReadLineNumber}+1",
  "Value": "!csvReadLineNumber"
},
{
  "Command": "if",
  "Target": "\"${!csvReadStatus}\" == \"OK\"",
  "Value": ""
},
{
  "Command": "store",
  "Target": "false",
  "Value": "!errorIgnore"
},
{
  "Command": "gotoLabel",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "END",
  "Value": ""
},
{
  "Command": "label",
  "Target": "OPERATIONS",
  "Value": ""
},
{
  "Command": "echo",
  "Target": "csvReadStatus \"${!csvReadStatus}\" || GLOBAL_TEMP \"${GLOBAL_TEMP}\"",
  "Value": ""
},
{
  "Command": "gotoLabel",
  "Target": "COL_COUNTER",
  "Value": ""
},
{
  "Command": "label",
  "Target": "END",
  "Value": ""
}

]
}

Just to clarify

Just to clarify: Why is the element missing?

  • Is the column missing altogether?
  • or your CSV file is just one large row that you want to read step by step?
  • or… ?

because there is no more columns in this file’s line, there are only 7.
i am trying to read the line with undefined amount of columns ( i expect maximum 9 columns in my macro for now).
In example i’ve provided (see above) there are 7 elements, and when 8-th element is requested - it gets an error, and i can’t avoid it.
Maybe you know better way to handle this case?