field_test

Returns the number of fields in the current window whose value matches data.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X      

Syntax

int field_test(data[,[name | number] | [attribute,flag]])
expr           data
string         name
int            attribute,number,flag

Description

data specifies the value against which to test fields. The field data will be converted to data's datatype before the comparison.

name (optional) specifies the name of a particular field to test.

number (optional) specifies the value of a field to test. It must evaluate to a valid field sequence number.

attribute (optional) specifies a bitmask.

flag (optional) if set to true, specifies that all fields with any of the user attributes are checked; otherwise, all fields that do not have any of the user attributes are checked.

Example

Modifies the active field based on the data in a field:
{
if (field_test(NULL,"ADDRESS") > 0) p.af = field_seq("PHONE");
else                                p.af = field_seq("ZIPCODE");
}
Tests to determine if the primary key is complete:
if (field_test(NULL,uat_prikey,true) != 0)
  error("Primary key is not complete.");