SetDBFieldFormat function

Syntax

SetDBFieldFormat(Field.FieldName, FormatFamily [, FamilyName, DisplayName])

Description

Use the SetDBFieldFormat function to change the format family for a field.

Use the StoredFormat Field property to determine the existing format family for a field.

If you only want to change the display format of a single field at runtime, and not change the database field, use the DisplayFormat Field property.

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.

FormatFamily

Specify the new format family of the field. The valid values are:

  • %FormatFamilyType_Upper

  • %FormatFamilyType_Name

  • %FormatFamilyType_Phone

  • %FormatFamilyType_Zip

  • %FormatFamilyType_SSN

  • %FormatFamilyType_MixedCase

  • %FormatFamilyType_NumOnly

  • %FormatFamilyType_SIN

  • %FormatFamilyType_PhoneIntl

  • %FormatFamilyType_ZipIntl

  • %FomatFamilyType_Custom

FamilyName

Specify a new family name. This parameter is optional, and only valid if FormatFamily is specified as custom (%FormatFamilyType_Custom).

DisplayName

Specify a new display name. This parameter is optional, and only valid if FormatFamily is specified as custom (%FormatFamilyType_Custom).

Returns

A constant value. The values are:

Value Description

%MDA_Success

Function completed successfully.

%MDA_Failure

Function didn't complete successfully.

Example

&ret = SetDBFieldFormat(Field.OrgId, %FormatFamilyType_Custom, "Postal_Code",⇒
 "Normal");  
If (&ret = %MDA_Success) Then 
   MessageBox(0, "Metadata Fn Status", 0, 0, "SetDBFieldFormat succeeded"); 
Else 
   MessageBox(0, "Metadata Fn Status", 0, 0, "SetDBFieldFormat 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.