Record Flush (Magic xpa 3.x)
The Record Flush event forces the writing of the current record to the database.
Usually, in an Online task, Magic xpa writes the current record when the user leaves that record – by moving to the next record or exiting the task. However, there are times that you will want to save the record before the user leaves the task. A common scenario is when you want to add a “print” button to the screen, to print the current record. If the print routine includes the current record, then you need to be sure that the current record is committed before the routine runs.
This is easily done by using the Record Flush internal event.
When this internal event is triggered, the Runtime engine will:
-
Perform a complete exit from the current record, including the Record Suffix.
-
Write the record to the database.
-
Read the record from the database again (regardless of the Cache strategy).
-
Perform the Record Prefix and remain on the same record.
-
Park the cursor on the first parkable control of the record.
This internal event can only be used in Online and interactive Rich Client tasks.
-
If the record is deleted, or its position changed by another end user, the cursor parks on the next record, and the message "Record is no longer in view" is displayed.
-
If the record is out of range, it will still remain on the screen unless the position of that record has changed.
-
If the index is modified by another user and the record is flushed, the record is displayed with its new index value.
-
On the Transaction Task level, the original record is displayed when activating rollback after flushing a modified record.
-
On the Transaction Record level, the modified record is displayed when activating rollback after flushing the modified record.
Note:
|
-
The record will be saved to the disk, only if the event is raised in the same task where the transaction began.
-
Instead of explicitly calling Record Flush, you can also use a User Event with a Force Exit of “Post Record Update”. This forces the current record to be written before the event is executed.
|
No default Keyboard Mapping
Data Refresh Events
How Do I Force Writing the Current Record to the Database?
The Online and Rich Client Samples projects (program SQ05, DV20, RSQ05, and RDV20)