SetDefault function
Syntax
SetDefault([recordname.]fieldname)
Description
Use the SetDefault function to set a field to a null value, so that the next time default processing occurs, it is set to its default value: either a default specified in its record field definition or one set programmatically by PeopleCode located in a FieldDefault event. If neither of these defaults exist, the Component Processor leaves the field blank.
Note:
This function remains for backward compatibility only. Use the SetDefault field class property instead.
Blank numbers correspond to zero on the database. Blank characters correspond to a space on the database. Blank dates and long characters correspond to NULL on the database. SetDefault gives each field data type its proper value.
See PeopleCode API Reference: SetDefault method: Field class.
Parameters
| Parameter | Description |
|---|---|
|
[recordname.]fieldname |
Specify a field designating the fields that you want to set to its default value. |
Returns
Optionally returns a Boolean value indicating whether the function executed successfully.
Example
This example resets the PROVIDER to its null value. This field is reset to its default value when default processing is next performed:
If COVERAGE_ELECT = "W" Then
SetDefault(PROVIDER);
End-if;
Where to Use SetDefault
If a PeopleCode program or function executes the SetDefault built-in on a field that does not exist in the component buffer, the remainder of the program or function is skipped. In the case of a function, execution of the calling program continues with the next statement after the call to the function. However, if the program containing the SetDefault call is at the "top level", meaning that it was called directly from the component processor or application engine runtime, it exits.
Therefore, if you want to control the behavior of SetDefault, you should encapsulate any calls to this built-in function inside your own functions. This enables your overall programs to continue, whether or not the SetDefault succeeds.