Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDES2GETSCDUSRS

SDES2GETSCDUSRS.m

Go to the documentation of this file.
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
 ;