How do I combine two variables?
Answer
Use ${VAR1}_${VAR2} in the same design object, or use a scripting variable.
There are two ways to combine two or more variables in Label LIVE.
Using Design Objects
Label LIVE design objects such as Text and Barcode use a special variable format. Read our variable guide for more information.
Example: Names
Combined: {LAST}, {FIRST}
Result: Combined: Larson, Caylan
Example: Telephone
Telephone: +{COUNTRY_CODE} ({AREA_CODE}) {DIGITS}
Result: Telephone: +1 (345) 123-9876
Using Script Variables
Label LIVE designs can use small scripts to combine variables. Read our logic guide for more information. Note that this syntax is JavaScript.
Example: Names
const { variables } = context;
const { FIRST, LAST } = variables;
context.result = LAST + ', ' + FIRST;
Result: Larson, Caylan
Example: Telephone
const { variables } = context;
const { COUNTRY_CODE, AREA_CODE, DIGITS } = variables;
context.result = `+${COUNTRY_CODE} (${AREA_CODE}) ${DIGITS}`;
Result: +1 (345) 123-9876
Other Ways to Concatenate
You can mix and match these techniques. Of course, there are many other ways to combine, split and manipulate variables within Label LIVE's scripting environment. You can use arrays, regular expressions, split, join, replace... the limit is your imagination!