[en] Tips and Tricks for Using Variables in Actions


[en] If using variables in NiceLabel Automation actions, follow these recommendations.

  • [en] Enclose variables in parentheses. If you have variables with spaces in their names and refer to variables in actions, such as Execute SQL Statement or Execute Script, enclose the variables in parentheses, as in (Product Name). Also use parentheses if variable names are the same as reserved names, e.g. in the SQL Statement.

  • [en] Place colon in front of the variable name. To refer to variables in Execute SQL Statement action or in Database Trigger, you have to place a colon (:) in front of the variable name, such as :(Product ID). The SQL parser understands it as 'variable value'.

    [en] SELECT * FROM MyTable WHERE ID = :(ProductID)

  • [en] Convert values to integer for computation. If you want to execute a numeric calculation with variables, make sure that you convert variable values to integers. Defining variables to be numeric only limits the acceptable characters for defining the value, but doesn't change the variable type. NiceLabel Automation treats all variables of string type. In VBScript, you would use the function CInt().

  • [en] Set default / start up values for scripts. When using variables in actions, make sure these variables have some default value assigned, or the script checking might fail. You can define default values in variable properties, or in a script (and remove them after testing the script).