3 Replies Latest reply: Apr 5, 2012 6:22 AM by cc cc RSS

    String variable in script

      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?