SDESGETDEVICES ;ALB/BWF,MGD - VISTA SCHEDULING RPCS - DEVICE RETRIEVAL ; June 28, 2024
;;5.3;Scheduling;**825,881**;Aug 13, 1993;Build 10
;;Per VHA Directive 6402, this routine should not be modified
;
Q
DEVICES(SDRES,LOOKUP) ;
N ERRORS,DEVICES,DEVLIST,DEV,DEVDAT,CNT,LOOKUPSHORT
S LOOKUP=$G(LOOKUP),CNT=80
D VALLOOKUP(.ERRORS,LOOKUP)
S LOOKUPSHORT=$E(LOOKUP,1,$L(LOOKUP)-1)
I $D(ERRORS) S ERRORS("Device",1)="" D BUILDJSON^SDESBUILDJSON(.SDRES,.ERRORS) Q
D DEVICE^XUDHGUI(.DEVICES,LOOKUPSHORT,1)
I '$D(DEVICES) S DEVLIST("Device",1)="" D BUILDJSON^SDESBUILDJSON(.SDRES,.DEVLIST) Q
S DEV=0 F S DEV=$O(DEVICES(DEV)) Q:'DEV D
.S DEVDAT=$G(DEVICES(DEV))
.I ($P(DEVDAT,U,2)'[LOOKUP),($P(DEVDAT,U,3)'[LOOKUP) Q
.S DEVLIST("Device",DEV,"ID")=$P(DEVDAT,U)
.S DEVLIST("Device",DEV,"Name")=$P(DEVDAT,U,2)
.S DEVLIST("Device",DEV,"DisplayName")=$P(DEVDAT,U,3)
.S DEVLIST("Device",DEV,"Location")=$P(DEVDAT,U,4)
.S DEVLIST("Device",DEV,"RightMargin")=$P(DEVDAT,U,5)
.S DEVLIST("Device",DEV,"PageLength")=$P(DEVDAT,U,6)
D BUILDJSON^SDESBUILDJSON(.SDRES,.DEVLIST)
Q
VALLOOKUP(ERRORS,LOOKUP) ;
I LOOKUP["*" D ERRLOG^SDESJSON(.ERRORS,52,"Search string cannot contain an *") Q
I LOOKUP="" D ERRLOG^SDESJSON(.ERRORS,277) Q
I $L(LOOKUP)>15 D ERRLOG^SDESJSON(.ERRORS,278)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETDEVICES 1312 printed Dec 13, 2024@02:56:54 Page 2
SDESGETDEVICES ;ALB/BWF,MGD - VISTA SCHEDULING RPCS - DEVICE RETRIEVAL ; June 28, 2024
+1 ;;5.3;Scheduling;**825,881**;Aug 13, 1993;Build 10
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
DEVICES(SDRES,LOOKUP) ;
+1 NEW ERRORS,DEVICES,DEVLIST,DEV,DEVDAT,CNT,LOOKUPSHORT
+2 SET LOOKUP=$GET(LOOKUP)
SET CNT=80
+3 DO VALLOOKUP(.ERRORS,LOOKUP)
+4 SET LOOKUPSHORT=$EXTRACT(LOOKUP,1,$LENGTH(LOOKUP)-1)
+5 IF $DATA(ERRORS)
SET ERRORS("Device",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDRES,.ERRORS)
QUIT
+6 DO DEVICE^XUDHGUI(.DEVICES,LOOKUPSHORT,1)
+7 IF '$DATA(DEVICES)
SET DEVLIST("Device",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDRES,.DEVLIST)
QUIT
+8 SET DEV=0
FOR
SET DEV=$ORDER(DEVICES(DEV))
if 'DEV
QUIT
Begin DoDot:1
+9 SET DEVDAT=$GET(DEVICES(DEV))
+10 IF ($PIECE(DEVDAT,U,2)'[LOOKUP)
IF ($PIECE(DEVDAT,U,3)'[LOOKUP)
QUIT
+11 SET DEVLIST("Device",DEV,"ID")=$PIECE(DEVDAT,U)
+12 SET DEVLIST("Device",DEV,"Name")=$PIECE(DEVDAT,U,2)
+13 SET DEVLIST("Device",DEV,"DisplayName")=$PIECE(DEVDAT,U,3)
+14 SET DEVLIST("Device",DEV,"Location")=$PIECE(DEVDAT,U,4)
+15 SET DEVLIST("Device",DEV,"RightMargin")=$PIECE(DEVDAT,U,5)
+16 SET DEVLIST("Device",DEV,"PageLength")=$PIECE(DEVDAT,U,6)
End DoDot:1
+17 DO BUILDJSON^SDESBUILDJSON(.SDRES,.DEVLIST)
+18 QUIT
VALLOOKUP(ERRORS,LOOKUP) ;
+1 IF LOOKUP["*"
DO ERRLOG^SDESJSON(.ERRORS,52,"Search string cannot contain an *")
QUIT
+2 IF LOOKUP=""
DO ERRLOG^SDESJSON(.ERRORS,277)
QUIT
+3 IF $LENGTH(LOOKUP)>15
DO ERRLOG^SDESJSON(.ERRORS,278)
+4 QUIT