SetDBFieldNotUsed function
Syntax
SetDBFieldNotUsed(Field.FieldName, NotUsed)
Description
Use the SetDBFieldNotUsed function to specify whether a database field is used as a chart field or not.
SetDBFieldNotUsed does the following for a field:
-
Specifies whether the field is included in the index when indexes are built for records that contain this field. The column always remains in the table associated with the record.
-
Specifies that the field is ignored in Query.
-
Specifies that the field is ignored in nVision.
In addition, fields marked as Search Keys or List Box Items in the Application Designer that are set as not used do not display in search dialogs and list boxes.
Parameters
| Parameter | Description |
|---|---|
|
FieldName |
Specify the name of the field that you want to modify. This name must be prefixed by the reserved word Field. |
|
NotUsed |
Specify whether this field is to be used as a chart field. This parameter takes a Boolean value: True, this field is not used, False, this field is used. |
Returns
A constant value. The values are:
| Value | Description |
|---|---|
|
%MDA_Success |
Function completed successfully. |
|
%MDA_Failure |
Function didn't complete successfully. |
|
%MDA_FieldNotFound |
The specified field wasn't found. |
Example
&ret = SetDBFieldNotUsed(Field.OrgId, True);
If (&ret = %MDA_Success) Then
MessageBox(0, "Metadata Fn Status", 0, 0, "SetDBFieldNotUsed succeeded");
Else
MessageBox(0, "Metadata Fn Status", 0, 0, "SetDBFieldNotUsed failed");
End-If;
Considerations Using this Function
This function is primarily intended for use during configuration time only, before active runtime usage is initiated. Using this function during active runtime is not, in general, supported. Changes to data definitions are not recognized on currently loaded component. In general, changes aren't recognized until the component is reloaded. Using this function to modify records in components that have not been loaded, and then loading those components will, while not changing indices, prevent Query and nVision from using the field, and may be used to key display of the field in pages.
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.