$fieldvalrep
Return or set the associative (ValRep) list for an instance of a field.
Get ValRep: $fieldvalrep { (
Field {,
List})
}
Set ValRep:
$fieldvalrep { (
Field)
}
=
List
Parameters
Parameter | Data Type | Description |
---|---|---|
Field | String | Field name; optional. It can optionally
contain a qualified field name, for example MYFLD.MYENT . If omitted, the current
field is used. |
List | String | Associative list that contains the desired ValRep items for this field instance |
Return Values
- Associative list (ValRep) list used by a widget for the specified field in the current occurrence only.
- Empty string ("") if no list has been declared for the field with $fieldvalrep or if the field cannot be found.
Use
Allowed in all component types except self-contained Services.
Description
The function $fieldvalrep returns or sets 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.
The ValRep list determines the values that are allowed in that field. For example, defining a ValRep list for a unifield or an edit box limits the values that the user may enter. This can be considered an extra layer of syntax checking for the field.
Setting $fieldvalrep
To set the value of $fieldvalrep, List should be an associative list that contains the desired ValRep items for this field instance. The ValRep list set with $fieldvalrep:
-
Overrides the ValRep list that is defined with the function $valrep or the widget definition.
-
Remains in effect until it is explicitly reset with another $fieldvalrep reference or until all ValRep lists in the component are reset with actions such as clear and retrieve.
-
Is not reset by actions like ^NEXT_FIELD or ^PREV_OCC.
Updating Tree Widget ValReps
When used in tree widget fields, $fieldvalrep functionality is extended to manipulate the contents of ValRep list, enabling you to re-order, partially update, or delete the contents of the tree widget. For more information, see Defining and Updating ValRep Lists for the Tree Widget.
Using $fieldvalrep
In the following example, the underlined
semicolon (;
) represents the Uniface subfield separator (by default,
GOLD ;).
The example sets the ValRep for the drop-down list for the TITLE in each occurrence depending on the person's gender:
if (GENDER.PERSON = "M") $fieldvalrep(TITLE.PERSON) = "Mr.;Dr.;Prof." else if (GENDER.PERSON = "F") $fieldvalrep(TITLE.PERSON) = "Ms.;Mrs.;Miss;Dr.;Prof." endif endif