Parameter | Description |
---|---|
iField | Number of the column in the table |
iOption | The option to get/set |
Property Integer Field_Option
Read Access: | Get Field_Option iField iOption to IntegerVariable |
Write Access: | Set Field_Option iField iOption to IntegerVariable/Value |
Field_Option gets/sets the state of a field option for a table column.
Set Field_Option of hDD iField DD_NoPut to True Set Field_Option of hDD Field FileName.FieldName DD_NoPut to False Get Field_Option of hDD iField DD_NoPut to bIsSet Get Field_Option of hDD Field FileName.FieldName DD_NoPut to bIsSet
Field Options can be toggled ON or OFF at the object or class level. For example, in Customer.dd (cCustomerDataDictionary class) in the Order Entry Sample application, Customer.EMail_Address is set to Required (DD_REQUIRED = True). This can be toggled to False at the DataDictionary Object (DDO) level in the Customer view to make the email address column not required.
Object oCustomerDataDictionary is a cCustomerDataDictionary Set Field_Option Field Customer.EMail_Address DD_REQUIRED to False End_Object
Set Field_Option Field Customer.Id DD_Commit to True
A record goes through two states, not committed and committed, which may require different data entry behaviors. By default, a record that is new is not committed and a record that is saved is committed. If DD_Commit is set, it means that this column cannot be changed if the record is committed. Basically it makes this field NoPut (see below) when committed.
Set Field_Option Field Customer.Id DD_AutoFind to True
DD_AutoFind executes an automatic find eq (equals) by the main index (see DF_Field_Index) of the column when the user navigates out of a data entry object (DEO) for the column. This option will not work on a column that does not have a main index.
If a record is found whose value in the main index of the column exactly matches the values in the DEO and any other items whose columns participate in the index, it is displayed and moved into the buffer. If no such record is found, the cursor exits the form normally and no record is moved into the buffer. No error will be declared.
You would usually set this option on every key column (Key_Field_State is True) in your database.
Where you wish to find by a non-unique index, use Auto-Find GE.
Where you are auto finding by a multi-segment index, place the DD_AutoFind option on the last column that participates in the index.
If used together with Find-Required, Auto-find will require users to enter a valid existing key before continuing.
Set Field_Option Field Customer.Id DD_AutoFind_GE to True
DD_AutoFind_GE performs a find ge (greater than or equal to) by the main index of the column when the user navigates out of a DEO for the column. This option will not work on a column that does not have a main index. If a record is found whose value in the main index of the column exactly matches the values in the column's DEO and any other forms whose columns participate in the index, it is displayed and moved into the buffer. If no such record is found, the record whose index value follows that in the form(s) is displayed and moved into the buffer.
Auto-Find GE is useful for finding records on partial entries to items or, in multi-segment indexes, by keys for only the first segment or segments (rather than all of them). All non-unique indexes, for example, are multi-segment (being composed of at least one column plus a record ID column).
You may use Auto-Find GE with any indexed column regardless of whether the column's main index is unique or not.
If you are using Auto-Find GE by a multi-segment index, place the DD_AutoFind_GE option on the last column in the index for which you wish to use an entered key value. If any column that comes before the one with the DD_AutoFind_GE option on it in the index lacks an entered key value in its form, the value of that column will be considered empty for purposes of the find. The found record will be the one whose value for the first such column is the lowest in the index.
If you want to execute an automatic find eq (equals) command for an exact match with the entered data, use the Auto-Find option instead (above).
Auto-Find GE will always find a record, unless the table has no records in it.
Set Field_Option Field Customer.Id DD_CapsLock to True
DD_CapsLock automatically converts any lower-case characters entered into a DEO associated with the column, to upper case. It has no effect on non-alphabetic characters. This assures that all input to the column through DEOs will be saved with letters in upper case.
Set Field_Option Field Customer.Id DD_ForcePut to True
DD_ForcePut forces the contents of DEOs connected to a column to be put to the table's record buffer before a save even if no changes were made to the form.
Normally the contents of a DEO are put to the buffer only if they have been changed from what was originally displayed from the disk
Set Field_Option Field Customer.Id DD_NoEnter to True
DD_NoEnter prevents data entry through any form associated with the column.
Although data cannot be entered from the keyboard to a form controlled by No-Enter, data can still be moved to the form under program control. Such data changes will be moved to the record buffer and saved, unlike with the Display-Only or No-Put field options.
Set Field_Option Field Customer.Id DD_NoPut to True
DD_NoPut stops data being moved from the DEO back to the record buffer for the column, even if new data is entered from the keyboard. No-Put is useful for allowing data to be entered into a form for finding, where you do not wish to allow the column to be changed.
Use the No-Put column option when you want to prevent users from changing data.
Set Field_Option Field Customer.Id DD_DisplayOnly to True
DD_DisplayOnly causes the cursor to skip the DEO associated with this column and prevents any data in the form from being changed. The form will display the column data as disabled.
DD_DisplayOnly is the equivalent of a combination of the DD_NoEnter and DD_NoPut options:
Set Field_Option Field Customer.Id DD_Zero_Suppress to True
DD_Zero_Suppress blanks the display of the column's DEO if it is a numeric column with value of zero (0).
Make sure you set Field_Mask_Type to Mask_Numeric_Window or Mask_Currency_Window for DD_Zero_Suppress to work.
Set Field_Option Field Customer.Id DD_Required to True
DD_Required ensures that data is entered into a column. This is not intended to be used with Numeric fields. Use a Field Validation instead.
Any character or characters entered in the DEO will allow the cursor to move on to the next form.
This required validation is also applied during a save.
Set Field_Option Field Customer.Id DD_FindReq to True
DD_FindReq prevents the cursor from going to the next DEO until a successful find on the form connected to this column places an active record in the view. An unsuccessful find causes Error 90 (Please enter a valid record ID).
Find-Required has no effect if an active record for the column's table is already in the view.
You would normally apply Find-Required only as a foreign-column option in a parent table to ensure that a related parent record is found before a save occurs in the child.
An Auto-Find option on the column with a Find-Required will attempt the required find automatically when a user attempts to move the cursor out of the form. If the automatic find is successful, the cursor will proceed. If it is not, Error 90, Please enter a valid record ID, is declared.
A Find-Required with an Auto-Find GE is unnecessary. Auto-Find GE always finds a record in a non-empty database file.
This find required validation is also applied during a save.
See the Field Options section in the DataDictionary Guide for the complete list and description of field options.
This function returns true if a customer name is required.
Function IsCustomerNameRequired returns Boolean Boolean bOptionEnabled Get Field_Option of Customer_DD Field Customer.Name DD_Required to bOptionEnabled Function_Return bOptionEnabled End_Function
The sample below is a more generic version of the above function, which allows checking if the column passed as iField in the DataDictionary passed as hDD has the column option passed as iOption enabled.
Function IsFieldOptionEnabled handle hDD integer iField integer iOption returns Boolean Boolean bOptionEnabled Get Field_Option of hDD iField iOption to bOptionEnabled Function_Return bOptionEnabled End_Function Procedure MyExample Integer iOptions iField Boolean bOptionEnabled // get the column number of Customer.Name column Field_Map Customer.File_Number "Name" To iField // check if DD_Required is enabled for Customer.Name Get IsFieldOptionEnabled Customer_DD iField DD_Required to bOptionEnabled End_Procedure
Remember allows the user to select a value in a DEO and say "remember this". When the record is cleared, this becomes the default value. See Field_RememberedValue for more information.
This sample shows how to implement a default sales person in the Order sample view. This demonstrates that DD Remember even works with related parent tables.
Object SalesP_DD is a Salesp_DataDictionary Set Field_RememberedValue Field SalesP.ID to "FF" End_Object
Many of the DataDictionary methods contain a two variants of the same message: Field_Message and File_Field_Message. For a complete description of these messages please refer to The Field and File_Field DD Interfaces.
The Field_ version of a message must use the keyword FIELD to identify the Table.Column name. The File_Field_ version must use the keyword FILE_FIELD to identify the Table.Column name. These should never be mixed!
// When using Field_ message use the FIELD keyword Set Field_Option Field Customer.Customer_Name DD_AutoFind to True // When using the File_Field_ message use the FILE_FIELD keyword Set File_Field_Option of oCustomer_DD File_Field Customer.Name DD_Autofind to True
Prior to version 14.1, the Set Field_Option had a different syntax. Field_Option_Clear was used to clear an option. The alternate syntax is now obsolete, but it is still supported for compatibility reasons.
Set Field_Option of hDD iField to DD_NoPut Set Field_Option of hDD Field FileName.FieldName to DD_NoPut
In addition, multiple options could be set by IOR-ing their values
Set Field_Option of hDD iField to (DD_AutoFind IOR DD_NoEnter)
This syntax cannot be modeled in the Studio's Visual DataDictionary Modeler and is discouraged.
See Also