Announcement

Collapse
No announcement yet.

EDC - Macro to Check for Changes on When Updating Data Entry

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • EDC - Macro to Check for Changes on When Updating Data Entry

    The attached macro, sclCheckForChanges, is placed in Screen Design in the onUpdate method. When the user updates the record, the system checks to see if there are any differences. After the macro, you can add code, for example, that will clear data from other fields.

    For instance, if the monitor has already reviewed the record and placed a check in the monitor reviewed check box, but the site needs to update the record, the site user makes a change to the record, updates the record, and is notified that a change exists. The system removes the check from the monitor's check box and asks the user to either accept the change or cancel the change. Accepting the change will allow the removal of the check. Canceling the change and canceling the update of the record will return the record to its original state before the change.


    Sample:

    Code:
    /** onUpdate Method **/
    
    %include objfile;
    
    _onUpdate: method _self_:u:object;
    link createobj;
    ************************;
    ** Add user code here **;
    ************************;
    
    ** check for changes - if change exists then clear monitor review check box **;
    %sclcheckforchanges;
    if hasChanges then monitorreviewed.selected='No';
    
    rcc=rcc;
    endmethod;
    01/15/2018 - Updated Macro sclCheckForChanges2
    sclCheckForChanges2 is a new version of the macro which is more robust then the original. This corrects an issue where a changes was not always detected when in Query Resolution mode. This should be used instead of of the original macro. The use is the same but the call from the screen must be updated to reference %sclCheckForChanges2. This allows for the existing macro and screens to remain unchanged while this version is implemented. If you wish to replace the original, both the file name and macro name must be updated by removing the 2.
    Attached Files
    Last edited by Greg Wagner; 01-15-2018, 04:30 PM.
Working...
X