setValrepArray()

Set the ValRep for a field in the current occurrence using an array. This ensures that the specified order of value-representation pairs is kept.

FieldObject.setValrepArray(ValRepArray)

Arguments

ValRepArray—new ValRep for the field instance, represented as an array. For example, in JavaScript Object Notation (JSON), such an array is represented as:

[
  ["1", "paperback"],
  ["2", "hardcover"],
  ["3", "e-book"]
]

Exceptions

The following exceptions may be thrown:

Description

The initial values of a DSP field's ValRep list can be set in the widget properties dialog, or they can be set in ProcScript using $fieldvalrep.

The setValrep and setValRepArray functions set the ValRep list for the specified field in the current occurrence. Only this single instance of the specified field is affected, and the ValRep list remains in effect even when the occurrence is no longer the current occurrence.

Once the DSP is loaded, the ValRep list of the field instance can be dynamically changed in the browser using the setValrep or setValRepArray API functions.

Range ValReps

For numeric fields, it is possible to specifying a Uniface range value in the format Min:Max for both values of a JavaScript range specification. For example:

field.setValrepArray( [["-1:5", "-1:5"]] );

For non-numeric fields, range Valreps are not supported, and specifying a range will result in a warning in the browser console.

If a range ValRep is defined for a field with a dropdown or radio group widget, a formatting error will be generated, and the definition ValRep (if defined) will be used. If no valid ValRep was defined, an empty ValRep will be set instead, and the range ValRep will be discarded.

Multi-range or nested range ValReps are not supported in DSPs.

Related Topics