Script Methods for Label Templates (Formats)

The following tables describe the methods provided for label templates (formats). These methods allow you to retrieve information about or make changes to fields or layer areas in a label template or to tags applied to a label template.

Tip: If using these script methods in a business rule, select the Rhino script engine.

Tip: Script methods with names beginning with get or is retrieve the current value for a property. Script methods with names beginning with set or move configure a value for the property.

Label Template or Layer Object Property

Method

Value

Description

getDocumentDpi()

setDocumentDpi(Integer)

Integer

Document DPI

The resolution in dots per inch that fields and areas on the label should be printed.

Important: The value selected affects the size at which bit mapped fonts are displayed. For example, a bit mapped font appears larger at 203dpi than at 400dpi because a 400dpi device produces smaller pixels.

Note: The value selected affects the values available for the Line X-Dim and Line Y-Dim properties in any barcode symbology in which they exist.

getBaseDocumentFontClassifier()

String

Font Category

The type of fonts to be used on the label.

Values: TrueType® or a printer control language

getShape()

setShape(String)

String

Shape

The appearance of the outside edge of the printed label.

Values: Rectangle, Rounded-Rectangle

getType()

String

The type of object. For a layer area, this refers to the type of object that contains it, which is a label template.

Value: label

Field

Method

Value

Description

findField(String)

Field

Retrieve a field by using its fully-qualified name.

Example

var field = FORMAT.findField("/Body/Text0001");

field.setVisible=false;

findFields(String)

A list of fields

Retrieve fields specified by search criteria.

Operation Description
&& Logical AND
|| Logical OR
!= Does not equal
== Equals
~= Equals, ignoring case
*= Contains
*~ Contains, ignoring case
^= Begins with
^~ Begins with, ignoring case
=^ Ends with
~^ Ends with, ignoring case

Example

var fields = FORMAT.findFields("(type=='text')");

var count = fields.length;

Example Criteria

(name=='t1' || type=='label') && visible!='false')

findFields

(String,boolean)

A list of field objects

Finds a list of fields by a set of criteria.

The Boolean value indicates whether to recurse through nested areas.

  • true: Recurse through nested areas to find all fields.
  • false: Find fields only at the same level.

Example

var fields = FORMAT.findFields("(type=='text',false)");

var count = fields.length;

Layer Area

Tip: For general information about layers or information about adding a layer areaClosed A type of area that contains a reference to either an existing layer object or to a data ref that resolves to the path to a layer object. A layer area can be added to the Label view of a label template. to a label template, see Using Layers. For information about creating a layer objectClosed A type of object that can contain fields appropriate for the Label view of label template. To be used by a label template, a layer object must be referenced by a layer area in the label template., see Create a Layer Object.

Method

Value

Description

getLayers()

A list of layer areas

Retrieve all layer areas in the label template.

findLayer(String)

Layer Area

Retrieve a layer area by using its fully-qualified name.

Example

var LayerArea = FORMAT.findLayer("/Body/Layer0001");

findLayers(String)

A list of layer areas

Retrieve layer areas specified by search criteria.

Operation Description
&& Logical AND
|| Logical OR
!= Does not equal
== Equals
~= Equals, ignoring case
*= Contains
*~ Contains, ignoring case
^= Begins with
^~ Begins with, ignoring case
=^ Ends with
~^ Ends with, ignoring case

 

Property Value Description

name

String

Name of a layer area.

fixed

Boolean

Whether a layer area is a Fixed Layer or a Variable Layer.

true: Fixed Layer

false: Variable Layer

dataRef

String

Data Reference. The data source used to provide the full path to the layer object in Loftware Enterprise SP.

visible

Boolean

Whether the layer area is visible.

true: The layer area is visible.

false: The layer area is hidden.

labelPath

String

The Default Value and version for the layer area. That is, the layer object associated with the layer area by default.

Example

var VariableLayers = FORMAT.findLayers(fixed=='false');

var VisibleLayers = FORMAT.findLayers(visible=='true');

var MyLayer = FORMAT.findLayers(dataRef=='/Example/MyLayer');

var Layer1Default = FORMAT.findLayers(labelPath=='/Example/Layer1:1.0');

Example Criteria

(name=='Layer1' || fixed=='true') && visible!='false')