SetRecFieldKey function
Syntax
SetRecFieldKey(Record.RecordName, Field.FieldName, Key)
Description
Use the SetRecFieldKey function to specify whether a field on a record is a key field or not.
Use the IsKey field class property to determine whether or not the field is already a key.
Note:
Because performing this operation changes records, you must subsequently rebuild the project (alter tables).
Parameters
| Parameter | Description |
|---|---|
|
RecordName |
Specify the record containing the field you want to change. This name must be prefixed by the reserved word Record. |
|
FieldName |
Specify the name of the field that you want to modify. This name must be prefixed by the reserved word Field. |
|
Key |
Specify whether the field is a key or not. This parameter takes a Boolean value: True, the field is a key field, False, it isn't. |
Returns
A constant value. The values are:
| Value | Description |
|---|---|
|
%MDA_Success |
Function completed successfully. |
|
%MDA_Failure |
Function didn't complete successfully. |
|
%MDA_RecordNotFound |
The specified record wasn't found. |
|
%MDA_RecFieldNotFound |
The specified field wasn't found on the record. |
Example
&ret = SetRecFieldKey(RECORD.AbsHist, Field.OrgId, True);
If (&ret = %MDA_Success) Then
MessageBox(0, "Metadata Fn Status", 0, 0, "SetRecFieldKey succeeded");
Else
MessageBox(0, "Metadata Fn Status", 0, 0, "SetRecFieldKey failed");
End-If;
Considerations Using this Function
This function is intended for use during configuration time only, before active runtime usage is initiated. Using this function during active runtime is not supported. Changes to data definitions are not recognized on currently loaded component. In general, changes aren't recognized until the component is reloaded.
WARNING:
These operations take place in a separate transaction from the page's save status: the initiation of any of these operations immediately changes the definitions, even if the page is subsequently cancelled.