Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to define a string variable and use it in a script. It works fine if I create the variable in the Variable Viewer:
Variable name = Status
Value = 'OK'
LOAD
INFO,
if(INFO=$(Status), $(Status), 'KO') AS INFO2
FROM file.xlsx [...];
But when I try to declare the variable in the script it fails:
SET Status='OK'; //I also tried SET Status="OK";
LOAD
INFO,
if(INFO=$(Status), $(Status), 'KO') AS INFO2
FROM file.xlsx [...];
Error:
Field not found <OK>
if(Status=OK,OK,'') AS INFO2
Quotes around 'OK' are removed so string OK is seen as a field name instead of a string value. If you look at the variable in the Variable Viewer:
Variable name = Status
Value = OK <------- quotes are missing
How to keep the quotes to make sure the variable is interpreted as a string and not a field name?
Hi,
try with this:
LOAD
INFO,
if(INFO='$(Status)', '$(Status)', 'KO') AS INFO2
FROM file.xlsx [...];
regards
Hi,
try with this:
LOAD
INFO,
if(INFO='$(Status)', '$(Status)', 'KO') AS INFO2
FROM file.xlsx [...];
regards
Hi,
Put your variable under quotes:
if(INFO='$(Status)', '$(Status)', 'KO') AS INFO2
It works like a charm! (I indeed got misleaded by the syntax editor coloring)
Thank you very much!