SetDBFieldLength function
Syntax
SetDBFieldLength(Field.FieldName, Length)
Description
Use the SetDBFieldLength function to modify an existing character field to have a new length.
Note:
Because using this function changes records that are used to build application tables, you must rebuild (alter) the specified project before these changes can be used.
Use the Length Field class property to find the existing length of a field.
Note:
This function only works with character fields.
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. |
|
Length |
Specify the new field length as a number between 1 and 254. |
Note:
If a default has been specified for this field in any record, and the size of the default is greater than the new size, you must modify the record field separately.
Returns
A constant value. The values are:
| Value | Description |
|---|---|
|
%MDA_Success |
Function completed successfully. |
|
%MDA_Failure |
Function didn't complete successfully. |
|
%MDA_Unsupported |
The specified field isn't a character field. This function is only supported for character fields. |
|
%MDA_FieldNotFound |
The specified field wasn't found. |
|
%MDA_FieldFmtLength |
The specified length isn't compatible with the current format family, or there are record field defaults greater than the specified size. |
Note:
If a default has been specified for this field in any record, and the size of the default is greater than the new size, you must modify the record field separately.
Example
&ret = SetDBFieldLength(Field.OrgId, 10);
If (&ret = %MDA_Success) Then
MessageBox(0, "Metadata Fn Status", 0, 0, "SetDBFieldLength succeeded");
Else
MessageBox(0, "Metadata Fn Status", 0, 0, "SetDBFieldLength failed");
End-If;
You can also use this function with de-referenced parameters, as follows:
&ret = SetDBFieldLength(@("FIELD." | FS_CF_UPD_AET.FIELDNAME), FS_CF_UPD_AET.NEW_⇒
CF_LENGTH);
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.
Related Topics