Use this procedure/function to assign a value to a section field. Normally, this procedure is used to assign values to display only fields or to assign default values to fields which have not yet been edited.
Note |
DAL internally manages Unicode strings using UTF8, which is a standard mechanism for handling Unicode string data. The SetFld function will use this method if the field is defined with a Unicode font. See the Unicode Guide for more information. |
SetFld (String, Field, Section, Form, Group)
Parameter |
Description |
String |
Enter a value appropriate for the field you are assigning. THe default is an empty string. |
Field |
Enter the name of a field. The default is the current field. |
Section |
Enter the name of a section that contains the field named. The default is the current section. |
Form |
Enter the name of a form that contains the section and/or field named. The default is the current form. |
Group |
Enter the name of the form group that contains the form, section, and/or field named. The default is the current group. |
The system returns one (1) if successful or zero (0) if the field cannot be changed or does not exist.
This procedure attempts to change the field's text each time the script executes. Therefore, use the SetFld procedure with discretion. Do not use the SetFld procedure if the script should not execute each time a user highlights a new field.
Here are some examples:
(Assume the section has three fields (First, Second, Third). The value of First is 123.)
Procedure |
Result |
Explanation |
SetFld( "N/A", "SECOND") |
1 |
Assume this script is associated with the field named First. When the user tabs from this field or highlights another field, the value of the field, Second is changed to N/A. |
IF ( !SetFld( 101, "MyField") ) "MyField", "not assigned!") END |
0 |
The IF statement determines whether or not the field MyField can be assigned the value "101". If not (meaning a field by that name does not exist or failed to accept the data), the message "Field MyField not assigned!" appears. |
SetFld( @( ), "MyField", , "FRM") |
1 or 0 |
This statement attempts to assign the value of the current field to MyField, located on the specified FRM. Since a section name was not given, the field may occur on any section on that form. |
© Copyright 2014, Oracle and/or its affiliates. All rights reserved. Legal notices.