Announcement

Collapse
No announcement yet.

Disallow Update of Non-Verified Records

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

  • Disallow Update of Non-Verified Records

    Disallow Update of Non-Verified Records

    The following macro code can be used to prevent a user from updating a non-verified or partially verified record in update mode. The user is prompted with a message and the record is cleared.

    Download macro sclDisallowUpdateofNonVerified.sas


    For more information on using macros in SCL see this post


    Setup

    To use this macro, a macro library must be defined at global, source or study level and the macro file placed in there.

    In the data entry screens onLoad() method, add the following line:

    Code:
    ** Call macro to prevent users from updating non-verfied records in update mode **;
    %sclDisallowUpdateofNonVerified;
    Save the screen and test. The user will be presented with the following message.

    Note: To change the text of the message edit the message list in the macro and recompile the screen.




    Macro code:
    Code:
    /*********************************************************
      Disallow update of a reocrd in UPDATE mode if the
      record is not verified.
    *********************************************************/
    %macro sclDisallowUpdateOfNonVerified;
        dcl object fid1 info;
        fid1=_self_.frameid;
        fid1._getNumVar('recordInfo',info);
    
        if info.entryMode='UPDATE' then do;
            if info.statusCode^='V' then do;
                myMessage={'This record can not be edited in UPDATE mode',
                              'until it has been verified.','','',
                              'The record will be cleared.'};
                rc=insertc(myMessage,'The current status is: '||info.statusCode,4);
                rc=rc;
                dcl char rcc=messagebox(myMessage,'I','O','Note');
                call execcmd('clear');
            end;
        end;
    %mend;
    Attached Files
    Last edited by dkeesey; 07-14-2009, 02:18 PM.
Working...
X