Command Reference - Design-time Constants
Before an expression is evaluated, any design-time constants in it are replaced by the values they represent. If these values contain spaces (or other value-delimiting characters) they can cause the expression to produce unexpected results, and even generate errors at run time.
For instance, let's say we want to concatenate (i.e. join) the string " is a nice person" to the string contained in the constant #UserName#. We could use the expression:
#UserName# + " is a nice person"
...which works fine if the constant #UserName# contains a single word like Mark. But if #UserName# contains a space like, say, Mark Smark, the expression becomes:
Mark Smark + " is a nice person"
...which fails, because Mark and Smark are seen as two separate values with no operator between them. The space between Mark and Smark acts as a delimiter, "splitting" the words into two separate values. AutoPlay Media Studio expects to see Mark <operator> Smark, but the operator is missing, and the resulting "broken" expression generates an error.
In order to avoid these problems, it's a good idea to surround design-time constants with quotation marks when using them in expressions. Any value between quotes is always interpreted as a single value, regardless of any spaces or other delimiting characters it might contain. By putting quotes around constants, each constant is guaranteed to be seen as a single value.
So, if we rewrite our example expression as:
"#UserName#" + " is a nice person"
...we end up with:
"Mark Smark" + " is a nice person."
...which will not cause any problems.
|
NOTE |
|
|
|
|
|
Design-time constants only need to be quoted in two places: in expressions, and in the command line arguments for an execute command. You don't have to put quotes around constants anywhere else. |