GetFieldValue Method
The GetFieldValue method retrieves the current value of a field.
This method has the following syntax:
integer = FieldObject.GetFieldValue(value = byref(variable))
The method returns the value of the field represented by FieldObject into the variable you specify. The value of variable can be a data type that can be nullable or an instance of a user class. The data types of variable and the value that it is assigned must be the same or compatible (in which case, OpenROAD automatically converts the value to the data type of variable).
This method provides a way to obtain the value of dynamically created fields because these fields do not have associated variables that you can reference in the 4GL code. You can, however, use this method with any field that you have created dynamically or in Workbench.
For example, assume that you want to get the value of a field and have only the name of the field. You can use this method, in conjunction with the FieldByName method, to retrieve the value with the following 4GL code:
/* declarations */
ret_value = integer;
fld = FieldObject;
salary_value = money;
...
/* Get value of an entry field named salary_fld, of
** type money
*/
fld = CurFrame.FieldByName(name = 'salary_fld');
ret_value = fld.GetFieldValue(value =
byref(salary_value));
The FieldByName method returns the field object that represents salary_fld. The GetFieldValue method uses this object to obtain the value of the field and place it in the variable, salary_value.
If the method is successful, it returns ER_OK. If it is not successful, it returns a non-zero value. Descriptions of system constant values and their numeric equivalents are listed in
Error Codes.
For more information about using this method, see the Programming Guide.
Last modified date: 12/20/2023