VA FileMan V. 22.2 Programmer Manual Banner


 

Main Chapter Getting Started Manual Advanced User Manual

Trigger Cross-References


Trigger on the Same File

Adding a time and date stamp to the file whenever a particular field is updated is a simple example of a trigger. Suppose the PATIENT (#2) file has a date-valued field called DATE NAME CHANGED. The following figures illustrate how you could put the current date and time into this field whenever the patient's NAME is entered or changed:

Figure 407: Trigger Cross-References—Creating Trigger

    Select OPTION: UTILITY FUNCTIONS <Enter>
    Select UTILITY OPTION: CROSS-REFERENCE A FIELD <Enter>

    MODIFY WHAT FILE: PATIENT <Enter>                    (1890 entries)
    Select FIELD: NAME <Enter>

    CURRENT CROSS-REFERENCE IS REGULAR 'B' INDEX OF FILE

    Choose E (Edit)/D (Delete)/C (Create): CREATE <Enter>
    WANT TO CREATE A NEW CROSS-REFERENCE FOR THIS FIELD? NO// Y <Enter> (YES)
    CROSS-REFERENCE NUMBER: 2// <Enter>
    Select TYPE OF INDEXING: REGULAR// TRIGGER <Enter>

    WHEN THE NAME field (#.01) of the PATIENT File (#2) IS CHANGED, WHAT FIELD SHOULD
    BE 'TRIGGERED': DATE NAME CHANGED <Enter> ..OK

The field to be triggered must already exist.

Figure 408: Trigger Cross-References—SET Logic

    ---- SET LOGIC ----

    IN ANSWERING THE FOLLOWING QUESTION, 'DATE NAME CHANGED'
       CAN BE USED TO REFER TO THE EXISTING TRIGGERED FIELD VALUE.
    PLEASE ENTER AN EXPRESSION WHICH WILL BECOME THE VALUE OF THE DATE
    NAME CHANGED field (#2) OF THE 'PATIENT' File (#2)
     WHENEVER 'NAME' FIELD IS ENTERED OR CHANGED: NOW <Enter>

    DO YOU WANT TO MAKE THE SETTING OF 'DATE NAME CHANGED' CONDITIONAL?
      NO// <Enter> (NO)

If you answer YES, you can set conditions for the trigger. You get the following prompt:

Figure 409: Trigger Cross-References—KILL Logic

    ENTER AN EXPRESSION FOR THE CONDITION: <Enter>

    --- KILL LOGIC ---

    IN ANSWERING THE FOLLOWING QUESTION, 'DATE NAME CHANGED'
     CAN BE USED TO REFER TO THE EXISTING TRIGGERED
     FIELD VALUE. NOTE: 'OLD NAME' CAN BE USED TO REFER TO THE VALUE
     OF THE NAME FIELD BEFORE ITS CHANGE OR DELETION.
    PLEASE ENTER AN EXPRESSION WHICH WILL BECOME THE VALUE OF
    THE 'DATE NAME CHANGED' field (#2) OF THE 'PATIENT' File (#2)
      WHENEVER 'NAME' IS CHANGED OR DELETED: <Enter> NO EFFECT

You have specified that the NAME field triggers the DATE NAME CHANGED field (noting that the NAME field is already cross-referenced in the usual way). You have requested that the current DATE/TIME (NOW) be stuffed into the triggered field.

Since this triggering occurs whenever NAME is changed, you do not have to specify anything else that depends on the pre-existing value of NAME. When the entire patient entry is deleted, the DATE NAME CHANGED is deleted along with the name. Thus, no KILL logic is needed. The response to pressing the Enter key at that prompt is "NO EFFECT".

Since you always want the trigger to take place when NAME is changed, no condition is placed on the trigger. A trigger can be set up that only occurs under specified circumstances.

Figure 410: Trigger Cross-References—Conditions

    WANT TO PROTECT THE 'DATE NAME CHANGED' FIELD, SO THAT
    IT CAN'T BE CHANGED BY THE 'ENTER & EDIT' ROUTINE? NO// YES

You specify that the only way you want the DATE NAME CHANGED field to be updated is via this trigger. No Enter or Edit File Entries [DIEDIT] option user (not even one with an at-sign [@]) is able to change a patient's DATE NAME CHANGED field directly.

Figure 411: Trigger Cross-References—Deletion Restrictions

    NO-DELETION MESSAGE: <Enter>

If you enter a free text message at this prompt, this cross-reference cannot be deleted.

Figure 412: Trigger Cross-References—Description

    DESCRIPTION:
    1>The DATE NAME CHANGED field is triggered whenever the
    2>NAME field is entered or updated. The triggered value is
    3>NOW. This field cannot be edited.
    4><Enter>

The description appears in a standard DD listing.

Figure 413: Trigger Cross-References—Confirmation

    ...CROSS-REFERENCE IS SET

    DO YOU WANT TO RUN THE CROSS-REFERENCE FOR EXISTING
    ENTRIES NOW? NO// <Enter>

Finally, you have the option of using the new trigger to update the file. In this case, it would not be useful to put the current date and time into the DATE NAME CHANGED field for every existing entry. Thus, the NO default is accepted.

 


Reviewed/Updated: May 2026