Actions properties

Action properties let you evaluate (execute) formulas when specific events occur.  Action properties are available in the when you select an individual database field.

Property

Description

Default value

The value used to populate the record when it is initially displayed and added to the database.  Default value can be specified as a formula.

Note: If you initialize a field for which the Display Foreign Key As option is set, the initialization value “supersedes” the Display Foreign Key As setting and the database will not be queried to display the string value corresponding to the initialization value unless the Control Type is a list box, dropdown list, or radio button list.  List boxes require the database to be queried to determine all of the foreign key values in order to build the list; this is not true for Control Types that display only a single value – the initialization value.

Example: Default value formula for an OrderDate can be

= Today()

Display as

Specifies a formula to display if the field is a foreign key to another table.  If this is specified, then an evaluated formula from the joined table (foreign key value) is displayed rather than the field in the local table.

Note: Iron Speed Designer does not support setting Display As for composite foreign keys or composite virtual foreign keys.  Only single, non-composite foreign keys may be used.

Example: Formula for a CustomerID field in the Orders table can be

= Customers.CompanyName + “ “ +Customers.Country

However, formula cannot contain fields from 2 different tables. For example,

= Customers.CompanyName + Orders.CustomerID would be invalid

Right mouse click on the database formula tab displays all the fields that can be used in the Display As formula.

Initialize when inserting record

A formula applied to the selected field just before the record is inserted in the database.

Example: Initialize a date field

= Today()

Initialize when reading record

A formula applied to the selected field when a record is being read from the database.

Example: Password field can have a formula as

= Encrypt(Password)

Note: Whenever a ‘reading record’ formula is applied, changes made while reading a record must be undone while saving a record. The purpose of ‘reading record’ formula is just to display a value on a page by adding some formatting or formula. But while saving a record, web page values are always saved to the database. So, you may need strip or remove changes made when reading a record in your ‘inserting record’ and ‘updating record’ formulas.

As an example, if the Decrypt(Password) function is applied while reading then to undo these changes, the Encrypt(Password) function must be applied while saving a record. There are two different events for saving a record: The ‘Inserting record’ event occurs while adding a new record and the ‘updating record’ event occurs while modifying an existing record.

Initialize when updating record

A formula applied to the selected field just before the record is updated in the database.

Label text

The default field name used on web pages referencing the table which can be specified as a formula.  The display name can be further customized on a control-by-control basis by setting the control’s Properties.

This sequence applies to the Label text display:

If a user interface formula is specified

            displays result of the user interface formula

Else if a Text property is specified in the Property Sheet

            displays text property value specified in the Property Sheet

Else if a database formula is specified

            displays result of the database formula

Else

            displays default text

Example: RegionID field can have a Label text formula as

= Resource(“Region”)

where Region is a resource name

Validate when inserting record

A validation formula applied to the field just before the record is inserted in the database.

Example: Validation formula for a Quantity field

= IF(Freight < 100, "Error: Must be over 100", "")

Validate when updating record

A validation formula applied to the field just before the record is updated in the database.

Example: Validation formula for a Quantity field

= IF(Freight < 100, "Error: Must be over 100", "")

Action formulas are available in both the Data Access Layer via the Databases Property Sheet (described here) and in the Presentation Layer via the Page Property Sheet.  In some cases, you may have formulas in both the Data Access Layer and in the Presentation Layer, and the question arises as to which takes precedence.  Since formulas at both levels are always executed for their respective events, it is possible for one formula to override or overrule the result of another formula based on their execution sequence.  The chronological execution sequences (evaluation order) for formulas are:

Event

Execution sequence

Reading a record

1.  Initialize when Reading Record  (data access layer event)

2.  Initialize when Showing Record  (presentation layer event)

Adding a new record to the database

1.  Initialize when Adding Record (presentation layer event)

2.  Initialize when Inserting Record (data access layer event)

Updating an existing record in the database

1.  Initialize when Editing Record (presentation layer event)

2.  Initialize when Updating Record (data access layer event)