I am trying add the contents of a csv file to an paired array but I’m getting an error:
[error] [Line 8] Error in executeScript code: Unexpected identifier
{
"Name": "WIP_PODFileUpload",
"CreationDate": "2021-2-25",
"Commands": [
{
"Command": "csvRead",
"Target": "3docuploadmain.csv",
"Value": ""
},
{
"Command": "comment",
"Target": "isEligible",
"Value": ""
},
{
"Command": "executeScript",
"Target": "function isEligible(value) {\n if(value !== false || value !== null || value !== 0 || value !== \"\") {\n return value;\n }\n}\n",
"Value": "isEligible"
},
{
"Command": "comment",
"Target": "search",
"Value": ""
},
{
"Command": "executeScript",
"Target": "function search(nameKey, myArray){\nmyArray = myArray.filter(isEligible);\n for (var i=0; i < myArray.length; i++) {\n if (myArray[i].name === nameKey) {\n return myArray[i].value;\n }\n }\n}\n",
"Value": "search"
},
{
"Command": "comment",
"Target": "data",
"Value": ""
},
{
"Command": "echo",
"Target": "Status = ${!csvReadStatus}, line = ${!csvReadLineNumber}",
"Value": ""
},
{
"Command": "executeScript",
"Target": "var array = [\n { name:${!COL1}, value:\"Dis\"},\n { name:${!COL2}, value:\"Wat\"},\n { name:${!COL3}, value:\"tamat\"}\n];",
"Value": "data"
},
{
"Command": "comment",
"Target": "resultObject",
"Value": ""
},
{
"Command": "executeScript",
"Target": "var resultObject = ${search}(${col2},array);",
"Value": ""
},
{
"Command": "echo",
"Target": "${resultObject}",
"Value": ""
}
]
}