Using a Script to Inverse a Label Field

Description

A requirement exists to change the inverse property of a field to true, perhaps based upon the value of a different field. This can be done using a script.

How to create a script to change the inverse property of a label field

The actual script to change the inverse property of a field is as follows:

label.fields.field.(@name=="Text0000").font.@inverse = true;

 

Caution

The target field must support the inverse attribute. Some printer manufacturers have native fonts that do not support this setting.

Example

If a field's value is "DANGER", the field needs to be printed in inverse. Create the following script:

var input1 =String(label.fields.field.(@name == 'Text0000').@data);

if(input1== "DANGER") { label.fields.field.(@name=="Text0000").font.@inverse = true; }

The following sample labels display the results of the script when the value of Text0000 is CAUTION and when it is DANGER.