Add Logic with Script Variables
In software, it takes a lot of work to build new features without adding clutter. After listening to the feedback from over 10,000 customers, we found that 1% of feature requests seemed "one-off" - meaning, although that feature could be built, it might not be used by anyone else. Special features would "take up room" inside the app, and we'd always be responsible for making sure it didn't accidentally break in future versions.
Sometimes, the best way to build a custom feature isn't through more buttons and menus, it's by giving users the power to implement it themselves. With Script Variables, you can add complex business logic using modern JavaScript.
Understanding Variables
If you're new to Label LIVE and don't have experience with variables, please read our Understanding Data Variables guide to get up to speed.
Adding a Script Variable
From the Data tab click the
VARIABLES +
button.Change the type to Script and enter a name.
Click Add.
Script Editor
Open the script editor by clicking the new variable's name. The Script Editor has a text field for editing, buttons for undo/redo, and an Environment
popup. The context.result is shown in green.
Environment and Context
When the text field is focused a drawer appears on the right showing the available context object.
Below the text field you may find errors (red) and console output (yellow).
Use in Design Objects
Script Variables are used like any other variable in Label LIVE.
Enhancing Scripts
We are always looking to improve Label LIVE's logic and scripting abilities. If you find we're missing something please let us know.