SDES2GETSCDUSRS ;ALB/LAB - VISTA SCHEDULING RPC SDES2 GET SCHEDULING USERS ;JAN 19, 2024
;;5.3;Scheduling;**871**;Aug 13, 1993;Build 13
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
GETUSERS(RETURN,SDCONTEXT) ;Return recordset of all users in NEW PERSON having SDECZMENU and/or SDECZMGR key
;
N ERRORS,OUTPUT
D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
I $D(ERRORS) S ERRORS("SchedulingUser",1)="" D BUILDJSON^SDES2JSON(.RETURN,.ERRORS) Q
D BUILDUSERARRAY(.OUTPUT)
D BUILDJSON^SDES2JSON(.RETURN,.OUTPUT)
Q
;
BUILDUSERARRAY(OUTPUT) ;build the array of active users with scheduling keys SDECZMENU and SDECZMGR
;
N SDDUZ,SCHEDULEKEYIEN,COUNT,SCHEDULEKEY
S COUNT=0
F SCHEDULEKEY="SDECZMENU","SDECZMGR" D
. S SCHEDULEKEYIEN=+$O(^DIC(19.1,"B",SCHEDULEKEY,0))
. Q:'+SCHEDULEKEYIEN
. S SDDUZ=0
. F S SDDUZ=$O(^VA(200,"AB",SCHEDULEKEYIEN,SDDUZ)) Q:'+SDDUZ D
. . Q:SDDUZ<1
. . Q:$$GET1^DIQ(200,SDDUZ_",",7,"I")
. . S COUNT=COUNT+1
. . S OUTPUT("SchedulingUser",COUNT,"DUZ")=SDDUZ
. . S OUTPUT("SchedulingUser",COUNT,"NAME")=$$GET1^DIQ(200,SDDUZ_",",.01,"E")
. . Q
. Q
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2GETSCDUSRS 1154 printed Nov 22, 2024@18:04:09 Page 2
SDES2GETSCDUSRS ;ALB/LAB - VISTA SCHEDULING RPC SDES2 GET SCHEDULING USERS ;JAN 19, 2024
+1 ;;5.3;Scheduling;**871**;Aug 13, 1993;Build 13
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
GETUSERS(RETURN,SDCONTEXT) ;Return recordset of all users in NEW PERSON having SDECZMENU and/or SDECZMGR key
+1 ;
+2 NEW ERRORS,OUTPUT
+3 DO VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
+4 IF $DATA(ERRORS)
SET ERRORS("SchedulingUser",1)=""
DO BUILDJSON^SDES2JSON(.RETURN,.ERRORS)
QUIT
+5 DO BUILDUSERARRAY(.OUTPUT)
+6 DO BUILDJSON^SDES2JSON(.RETURN,.OUTPUT)
+7 QUIT
+8 ;
BUILDUSERARRAY(OUTPUT) ;build the array of active users with scheduling keys SDECZMENU and SDECZMGR
+1 ;
+2 NEW SDDUZ,SCHEDULEKEYIEN,COUNT,SCHEDULEKEY
+3 SET COUNT=0
+4 FOR SCHEDULEKEY="SDECZMENU","SDECZMGR"
Begin DoDot:1
+5 SET SCHEDULEKEYIEN=+$ORDER(^DIC(19.1,"B",SCHEDULEKEY,0))
+6 if '+SCHEDULEKEYIEN
QUIT
+7 SET SDDUZ=0
+8 FOR
SET SDDUZ=$ORDER(^VA(200,"AB",SCHEDULEKEYIEN,SDDUZ))
if '+SDDUZ
QUIT
Begin DoDot:2
+9 if SDDUZ<1
QUIT
+10 if $$GET1^DIQ(200,SDDUZ_",",7,"I")
QUIT
+11 SET COUNT=COUNT+1
+12 SET OUTPUT("SchedulingUser",COUNT,"DUZ")=SDDUZ
+13 SET OUTPUT("SchedulingUser",COUNT,"NAME")=$$GET1^DIQ(200,SDDUZ_",",.01,"E")
+14 QUIT
End DoDot:2
+15 QUIT
End DoDot:1
+16 QUIT
+17 ;