Required Fields
There are two methods you can use to require that a template variable be filled from a data source. The easiest way is simply to add “Required: true” to a variable definition (all fields default to false).
The second way is to add required logic using the RequiredIf condition. This allows you to set the required
flag based on other variables on the record. For example, you might want to require an inner pack length whenever
an inner pack quantity is provided.
An example of this is shown below (and in Sample2):
- {Name: $IN_PK_LEN, Type: "number", RequiredIf: "$IN_PK_QTY != nil && $IN_PK_QTY > 1"}
⚠️Important Note: a variable will be set to nil if the source cell is empty. Since nil is a special value
of unknown type, we get an error comparing a nil variable with a value of a known type.
That is why we need to first test for the nil value in the expression above. For more information,
see Short-Cicuit Evaluation