Save method: FieldDefn class
Syntax
Save()
Description
Use the Save method to validate and save a field definition to the database.
Parameters
None.
Returns
An integer representing the following statuses.
| Numeric Value | Constant Value | Descriptoin |
|---|---|---|
|
0 |
%MDA_Success |
The field definition is saved successfully. |
|
1 |
%MDA_Failed |
The field definition is not saved. |
|
2 |
%MDA_UseAppDesigner |
The specified field is not created using the PeopleCode FieldDefn class. |
|
4 |
%MDA_Unsupported |
The specified field type is not supported in PeopleCode. |
|
12 |
%MDA_InvalidDefn |
This value is returned when the validation fails. The detailed validation error messages are available through the Messages property. |
|
14 |
%MDA_NoWriteAccess |
The user doesn’t have write permissions to the field. |
Example
Local FieldDefn &newField = CreateFieldDefn();
If All(&newField) Then
&newField.Name = "MYNEWFIELD";
&newField.Type = %FieldType_Char;
&newField.Description = "My new field";
&retVal = &newField.SetLabel("MYNEWFIELD", "My field", "My New Field", True);
/* do error checking … */
Local date &myDate = Date3(1900, 1, 1);
&retVal = &newField.SetTranslateValue("A", True, &myDate, "My New XLAT", "My XLAT");
/* do error checking … */
&retVal = &newField.Save();
/* do error checking … */
End-If;
Related Topics