Check FirstKey/SecondKey User
This macro is designed to disallow a user from second keying a record that was fisrt keyed by them. A message box is displayed to the user when the record is loaded to notify them, then the screen is cleared.
Macro sclFirstKey.sas
Add call to onLoad(); method
To implement, save the macro into a global, source or study level macro directory and then add the macro call to the screens onLoad(); method as follows:
For more information on using macros within SCL code, please see the following post:
This macro is designed to disallow a user from second keying a record that was fisrt keyed by them. A message box is displayed to the user when the record is loaded to notify them, then the screen is cleared.
Macro sclFirstKey.sas
Code:
/************************************************** Macro sclFirstKey.sas Purpose: Checks that the second key user is not the same as the first key user. Modifications: 6/2/2008 - GW Added check of statusCode so that records already verified do not clear. This allows a user to navigate sequenced records even if they first keyed them. **************************************************/ %macro sclFirstKey; ** Get identifier for record information object **; dcl object f info; f=_self_.frameid; f._getNumVar('recordInfo',info); if info.entryMode='VERIFY' and info.StatusCode ^= 'V' then do; if info._usersKey=info._firstKeyUsersKey then do; msglist={'You are not allowed to verify this record','because you first keyed it.'}; dcl char rcc=messagebox(msglist,'I','O','Note'); msglist=dellist(msglist,'Y'); call execcmd('clear'); end; end; %mend sclFirstKey;
To implement, save the macro into a global, source or study level macro directory and then add the macro call to the screens onLoad(); method as follows:
Code:
%sclFirstKey;