Controls in the Update value section on the Value tab of the Attribute Properties dialog let you establish what, if anything, will trigger the attribute field to be updated.
Any field can be automatically updated when another defined field changes, or when any field changes. The value updated can be a fixed value, the result of an SQL SELECT statement, a value returned by a user defined function or a system variable or project property. You can define multiple fields to trigger the automatic update, so that the update occurs when any of the fields change, or you can set the field trigger to update whenever the record is updated.
The SELECT statements used to update a field or enter a default value will usually contain a WHERE clause to limit the number of records returned to a single value. The system variable $EDIT#field_name$ provides the means of specifying the value of another field in the current record. When using this system value in a SELECT statement, you must enclose it in single quotes, as shown here:
Suppose the environment contains the fields author, title, and date_of_birth and a table named authors which contains the fields name, title, and date_of_birth for a number of authors. You might use a pick list in the author field to select the author's name from the author table using the following SELECT statement:
SELECT name FROM authors ORDER BY authors;
Having selected an author, you probably want to fill the title and date_of_birth fields automatically from the authors table for the selected author. You can do this by making the author field a trigger field for the title and date_of_birth fields and using the SELECT statements:
SELECT title FROM authors WHERE authors.name = '$EDIT#author$;'
SELECT date_of_birth FROM authors WHERE authors.name = '$EDIT#author$;'
This assumes of course that the name field in the authors table is unique.
You can also call a function when a field is updated. In this case, you enter the name of the function and the name of the file containing it into the parameters field. For example, suppose you have another field in the environment table called log_file and you have written a function called UpdateLogFile contained in a dynamic link library update.dll. If you designate the log_file field's automatic update source to be a function and enter the parameters UpdateLogFile;update.dll, then the UpdateLogFile function is called when the field is triggered.
The value for an update can also be derived from a system variable or project property. In this case you enter the name of the system variable or project property in the parameters field. Suppose the environment table contains the fields date_of_change and amender. These fields can be automatically updated when any change is made to a record by setting the trigger to update when the attribute record is changed (the default value) and setting the source of update to System Variable. You would enter the system variables $DATE$ as the parameter for the date_of_change field and $USER$ as the parameter for the amender field.