SetDBFieldCharDefn function

Syntax

SetDBFieldCharDefn(Field.FieldName, Length [, FormatFamily])

Description

Use the SetDBFieldCharDefn function to create a field definition of type character, with the indicated name, length, and format family.

Note:

After using this function, you should use the SetDBFieldLabel function to define the label for the new field.

Parameters

Parameter Description

Fieldname

Specify the name of the new field that you want to create. This name must be prefixed by the reserved word Field.

Length

Specify the length of the new field as a number.

FormatFamily

Specify the format family of the new field. This parameter is optional: the default value is upper case. The valid values are:

  • %FormatFamilyType_Upper (default)

  • %FormatFamilyType_Name

  • %FormatFamilyType_Phone

  • %FormatFamilyType_Zip

  • %FormatFamilyType_SSN

  • %FormatFamilyType_MixedCase

  • %FormatFamilyType_NumOnly

  • %FormatFamilyType_SIN

  • %FormatFamilyType_PhoneIntl

  • %FormatFamilyType_ZipIntl

Returns

A constant value. The values are:

Value Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

%MDA_Duplicate

The field specified by FieldName already exists.

%MDA_FieldFmtLength

The specified length conflicts with the specified format family and was overwritten when the field was created.

Example

&ret = SetDBFieldCharDefn(Field.OrgId, 10,  
%FormatFamilyType_MixedCase);  
If (&ret = %MDA_Success) Then 
   MessageBox(0, "Metadata Fn Status", 0, 0, "SetDBFieldCharDefn succeeded"); 
Else 
   MessageBox(0, "Metadata Fn Status", 0, 0, "SetDBFieldCharDefn failed"); 
End-If;

You can also use this function with de-referenced parameters, as follows:

&ret = SetDBFieldCharDefn(@("FIELD." | FS_CF_UPD_AET.FIELDNAME), 
FS_CF_UPD_AET.NEW_CF_LENGTH, %FormatFamilyType_MixedCase);

The following example adds a new character field:

&cf = "CF1"; 
&len = 10; 
&frmt = %FormatFamilyType_Upper; 
&fld = "FIELD." | &cf; 
&ret = SetDBFieldCharDefn(@(&fld), &len, &frmt); 
If (&ret = 0) Then 
   MessageBox(0, "SetDBFieldCharDefn", 0, 0, "Succeeded"); 
Else 
   MessageBox(0, "SetDBFieldCharDefn", 0, 0, "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.

Related Topics