|
|
|
|
|
- Verification of desynchronization
Verification of desynchronization This code is used to check that the record manipulated in the database corresponds to the displayed record. This code is only executed if there is an ACTUAL desynchronization. CAUTION: In the case of an Ajax process, there is no page refresh, so there is no possible desynchronization. In Ajax processes that act on "current" records, it is therefore necessary to make sure that the current record is the one expected UNIQUEKEY_ID is 8-byte int // PageParameter() allows you to retrieve the values returned by the client page // In the page, "EDT_UNIQUE_KEY_ID" (a visible or invisible edit control), contains the unique key // on the current record UNIQUEKEY_ID = PageParameter(EDT_UNIQUE_KEY_ID..Alias) Â // The current record has been changed? // (gnLastIDDisplayed contains the identifier of the last one displayed) IF UNIQUEKEY_ID=gnLastIDDisplayed THEN // It is also possible to check the current record, example: // HRead(CUSTOMER, hNumCurrentRecord) // IF CUSTOMER.CUSTOMER_ID=UNIQUEKEY_ID THEN Â // The current record is the right one // Continue ChangeAction(caContinue) ELSE // The current record IS NOT the right one // Reposition at server level: IF NOT HReadSeekFirst(CUSTOMER, "UNIQUEKEY_ID", UNIQUEKEY_ID) THEN // successfully repositioned // Update the stored id (also when loading the page and // in any action that changes the current record) Â gnLastIDDisplayed = UNIQUEKEY_ID // successfully repositioned, let the execution continue // This will run the process requested by the Web user with // the record that was just repositioned ChangeAction(caContinue) ELSE // the record can no longer be found... // the user action is canceled, // the page will refresh with the data currently on the server Info("The data no longer exists, the requested action has not been taken into account", ... "Display the last data loaded on the server") PageRefresh() ChangeAction(caNone) Â // OR.... // leave the default process with the default error message // // ChangeAction(caError) END END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|