Ifchange Command
Obsolete
This command is replaced by the DF_FILE_CHANGED Database API attribute.
Purpose
To execute a command according to whether a change has been made to a record buffer.
Syntax
ifchange
df_filename command
Argument Explanation
- df_filename: Must be named literally (without quotation marks).
- command: Must be given literally (without quotation marks).
What It Does
ifchange df_filename executes command if there has been a change to any field of the record buffer for df_filename since the buffer was last filled, as part of a reread, save, clear, or successful find command.
ifchange pay gosub logchange
If any change has been made to the record buffer for Database File pay since the last time its buffer was filled, Subroutine logchange will be executed.
ifchange df_filename is generally used to take an action when any change is made to a file, such as posting to a log of all changes made to df_filename.
Notes
-
Ifchange operates on a change of value since the last runtime operation which noted that change. Thus, if the same value is entered from the keyboard as was previously in the window or field, no change will be recognized (the command will not be executed).
-
Clearing an existing value from an item does not produce a change in the record buffer. An entry of zero to a Numeric field or spaces to a String field will not cause ifchange commands to be executed.
-
The
elsecommand may not be used withifchange. To control program action on a buffer's not having changed, declare an indicator (or set it false) and reset its value with anifchangecommand, as follows:
indicate new_customer false
ifchange customer indicate new_customer true
In this example, Indicator new_customer is set to false and then, if a change has occurred in the buffer of File customer, it is set to true.