ValRep Lists and Ranges

Fields have a ValRep property that can be used to define a limited range of possible values for that field.

The values are specified as a Uniface list, usually an associative list of Values and their corresponding Representations (hence the name ValRep). A ValRep list allows you to store a short value for a field, while displaying a more meaningful representation. It is also possible to specify acceptable values as a range. For example

  • ValRep list: EN=English; FR=French;DE=German.
  • ValRep range: 1:5

Widgets and ValReps

The way in which the values are displayed depends on the widget. Some widgets, such as an edit box, do nothing with the ValRep. Widgets such as drop-down lists, radio buttons, and spinners interpret the ValRep, providing an entry method that prevents users from entering invalid values. Such widgets expect the ValRep to contain data that is formatted so that the widget can interpret it. For example:

  • A drop-down list expects a list of Value=Representation pairs displays the Representations (or the Values if no Representation is defined). When the user selects one, the corresponding value is selected.
  • A spinner widget, expects the ValRep to contain a numeric range in the format MinValue:MaxValue.

For more information on the syntax and use of ValReps, see ValRep property description, and widget documentation.

Syntax Checking and Validation

Uniface uses the values defined in a ValRep when performing syntax checks for fields at runtime. A user cannot enter a value that does not match the value or range of values specified in the ValRep.

ValReps can be set at runtime using ProcScript (using $valrep and $fieldvalrep) or , so Uniface imposes declarative and procedural validation checks on the value selected from a ValRep list.

Note:  Very large ValRep lists are not very practical for a user, and should normally be avoided. If you have a ValRep list of more than 32,768 items, you should set the $NO_VALREP_CHECK assignment setting to prevent the syntax check.

Related Topics