Overview of Field Rules

Description

Alpha Anywhere offers great flexibility for controlling data entry in your database. You can create Field Rules to govern how you enter data in a table or set, and help ensure that data entry is accurate, consistent, and complete. You use Field Rules to control the information that you can enter in a field.

For example, you have a phone number field in a customer table, and you want to require that a phone number be entered for each new customer in a specific format, (000) 000-0000. Here you would use mask and template field rules to define the format of the phone number. You would then specify the field as required to force field entry in order to save a new record. With sets, you can define and modify Field Rules for all fields in the set's component tables simultaneously. However, the rules defined for each field are stored only at the table level; a set does not have its own Field Rules.

Auto increment in Alpha Anywhere looks at the highest value for the field in a table, and adds one.

You can use Field Rules to perform the following tasks: 

  • Insert calculations or incrementing values

  • Validate, format, and insert field values

  • Change field entry case

  • Ensure reasonable and accurate values

  • Create table lookups for filling-in data

  • Post data from one table to another

  • Define Xbasic scripts for different events

Opening the Field Rule Editor 

  1. Right-click on a table in the Control Panel.

  2. Select Edit Field Rules from the right-click menu to display the Field Rule Editor.

  3. Use the drop-down box at the top to switch between fields.

  4. Use the tabs to switch between groups of Field Rules. Field Rule Editor:

    images/UG_Field_Rules_Field_Types_tab.gif

Deleting a Field Rule 

To delete a field rule:

  1. Display the Tables/Sets tab of the Control Panel.

  2. Select the table that contains the field rule.

  3. Select Design > Field Rules.

  4. Select the field that has the field rule from the drop-down list box.

  5. Select the tab that implements the rule.

  6. Click Rules > Delete Rule. If you want to delete all rules, select Rules > Delete All Rules.

Overview of Field Rules 

The following tables provide a brief description of each Field Rule.

Field Types 

Data Entry 

  • Required 

    Specifies that a field must contain data.

  • Masks/Templates 

    Inserts formatting characters, like dashes and spaces, and determines whether a number or letter can be entered in a particular location in the field. The commonly used template (000) 000-000 defines a phone number field. The 000000-0000 template defines the Zip + 4 field.

  • Auto-Advance 

    Moves the cursor to the next field when the current field is full; for example, after you enter both characters in a two-character state abbreviation field, the cursor moves to the next field.

  • Default Mode 

    When creating a new record, fills a field with a default value, which can be either a constant or the result of a expression.

  • Skip 

    Causes the cursor to skip over the field, when you press the Tab or Enter keys.

  • Position Cursor 

    Places the cursor at the beginning or end of selected or non-selected text, when the field gets focus.

Transformations 

  • Case Convert 

    Converts values to uppercase, lowercase, or a combination of both.

  • Speed Typing Glossary 

    Fills in a longer word or phrase, when you enter a user-defined keyword. (Included for V4 compatibility.) The preferred method is to use the Tools > Speed Glossary command,

Validations 

Lookups 

  • Simple List 

    Presents a pre-defined list of values for field entry.

  • Cascading List 

    Presents a pre-defined list, which can include multiple sub-lists, for field entry.

  • Table Lookup 

    Presents selections from an existing table, for field entry.

  • Conditional Table Lookup 

    Presents values for field entry, based on a conditional expression.

  • Previous Values 

    Presents values from a list of previously entered values.

Posting 

  • Posting 

    Posts data from the current field to a target field, allowing you to add to, subtract from, or replace the target field value. Posting does not create new records. Posting is useful for keeping a running total, by using the add option, or for tracking inventory levels, by using the subtract option.

Events 

  • Field Event 

    Lets you execute Xbasic code for the following field events: CanEditField, OnEditField, CanWriteField, and OnWroteField.

  • Record Event 

    Lets you execute Xbasic code for the following record events: CanEditRecord, OnEditRecord, CanChangeRecord, OnChangeRecord, CanSaveRecord, OnSaveRecord, CanMarkRecord, OnMarkRecord, CanUnmarkRecord, OnUnmarkRecord, CanDeleteRecord, OnDeleteRecord.