ONCSEDEM ;Hines OIFO/SG - EDITS API (DEMO) ; 11/6/06 11:56am
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
Q
;
;***** DEMO ENTRY POINT
;
; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
;
DEMO(ONCSAPI) ;
N CFGNAME,MSGLST,RC,REQUEST
W !!?10,"DEMO CLIENT FOR THE EDITS API",!
D CLEAR^ONCSAPIE(1)
S REQUEST=$NA(^TMP("ONCSEDEM",$J,1))
S MSGLST=$NA(^TMP("ONCSEDEM",$J,2))
;
;--- Check the DLL version
S RC=$$CHKVER^ONCSAPIV(.ONCSAPI)
D:RC<0 PRTERRS^ONCSAPIE(),CLEAR^ONCSAPIE()
;
D
. ;--- Ask user for configuration name
. S RC=$$GETCFG(.CFGNAME) Q:RC
. ;--- Prepare and execute the EDITS request
. W !,"Validating the data..."
. S RC=$$RBQPREP^ONCSED01(.ONCSAPI,.REQUEST,CFGNAME) Q:RC<0
. D NAACCR(.REQUEST)
. S RC=$$RBQEXEC^ONCSED01(.ONCSAPI,.REQUEST,MSGLST) Q:RC<0
. I RC>0 D Q:RC<0
. . N %ZIS,IOP,POP
. . S %ZIS("B")="BROWSER"
. . D ^%ZIS Q:$G(POP) U IO
. . S RC=$$REPORT^ONCSED01(.ONCSAPI,MSGLST,"MT")
. . D ^%ZISC
;
;--- Error processing and cleanup
D:RC<0 PRTERRS^ONCSAPIE()
K ^TMP("ONCSEDEM",$J)
Q
;
;***** ASKS USER FOR CONFIGURATION NAME
;
; .CFGNAME Reference to a local variable where the name
; will be returned to.
;
; Return values:
;
; <0 Error Descriptor (see ^ONCSAPI for details)
; 0 Ok
; 1 User canceled the output ('^' was entered)
; 2 Timeout
;
GETCFG(CFGNAME) ;
N DA,DIR,DIRUT,DTOUT,DUOUT,RC,X,Y
S CFGNAME=""
S DIR(0)="FO",DIR("B")="DEFAULT"
S DIR("A")="Configuration name"
D ^DIR
S RC=$S($D(DUOUT):1,$D(DTOUT):2,1:0) Q:RC RC
S CFGNAME=X
Q 0
;
;***** GENERATES A NAACCR RECORD WITH RANDOM DATA
NAACCR(ONCDST) ;
N I,TMP
F I=1:1:10 D
. S TMP="",$P(TMP,$C(64+$R(58)),$R(513)+1)=""
. D WRITE^ONCSNACR(.ONCDST,TMP)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSEDEM 1836 printed Dec 13, 2024@02:28:17 Page 2
ONCSEDEM ;Hines OIFO/SG - EDITS API (DEMO) ; 11/6/06 11:56am
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 QUIT
+4 ;
+5 ;***** DEMO ENTRY POINT
+6 ;
+7 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
+8 ;
DEMO(ONCSAPI) ;
+1 NEW CFGNAME,MSGLST,RC,REQUEST
+2 WRITE !!?10,"DEMO CLIENT FOR THE EDITS API",!
+3 DO CLEAR^ONCSAPIE(1)
+4 SET REQUEST=$NAME(^TMP("ONCSEDEM",$JOB,1))
+5 SET MSGLST=$NAME(^TMP("ONCSEDEM",$JOB,2))
+6 ;
+7 ;--- Check the DLL version
+8 SET RC=$$CHKVER^ONCSAPIV(.ONCSAPI)
+9 if RC<0
DO PRTERRS^ONCSAPIE()
DO CLEAR^ONCSAPIE()
+10 ;
+11 Begin DoDot:1
+12 ;--- Ask user for configuration name
+13 SET RC=$$GETCFG(.CFGNAME)
if RC
QUIT
+14 ;--- Prepare and execute the EDITS request
+15 WRITE !,"Validating the data..."
+16 SET RC=$$RBQPREP^ONCSED01(.ONCSAPI,.REQUEST,CFGNAME)
if RC<0
QUIT
+17 DO NAACCR(.REQUEST)
+18 SET RC=$$RBQEXEC^ONCSED01(.ONCSAPI,.REQUEST,MSGLST)
if RC<0
QUIT
+19 IF RC>0
Begin DoDot:2
+20 NEW %ZIS,IOP,POP
+21 SET %ZIS("B")="BROWSER"
+22 DO ^%ZIS
if $GET(POP)
QUIT
USE IO
+23 SET RC=$$REPORT^ONCSED01(.ONCSAPI,MSGLST,"MT")
+24 DO ^%ZISC
End DoDot:2
if RC<0
QUIT
End DoDot:1
+25 ;
+26 ;--- Error processing and cleanup
+27 if RC<0
DO PRTERRS^ONCSAPIE()
+28 KILL ^TMP("ONCSEDEM",$JOB)
+29 QUIT
+30 ;
+31 ;***** ASKS USER FOR CONFIGURATION NAME
+32 ;
+33 ; .CFGNAME Reference to a local variable where the name
+34 ; will be returned to.
+35 ;
+36 ; Return values:
+37 ;
+38 ; <0 Error Descriptor (see ^ONCSAPI for details)
+39 ; 0 Ok
+40 ; 1 User canceled the output ('^' was entered)
+41 ; 2 Timeout
+42 ;
GETCFG(CFGNAME) ;
+1 NEW DA,DIR,DIRUT,DTOUT,DUOUT,RC,X,Y
+2 SET CFGNAME=""
+3 SET DIR(0)="FO"
SET DIR("B")="DEFAULT"
+4 SET DIR("A")="Configuration name"
+5 DO ^DIR
+6 SET RC=$SELECT($DATA(DUOUT):1,$DATA(DTOUT):2,1:0)
if RC
QUIT RC
+7 SET CFGNAME=X
+8 QUIT 0
+9 ;
+10 ;***** GENERATES A NAACCR RECORD WITH RANDOM DATA
NAACCR(ONCDST) ;
+1 NEW I,TMP
+2 FOR I=1:1:10
Begin DoDot:1
+3 SET TMP=""
SET $PIECE(TMP,$CHAR(64+$RANDOM(58)),$RANDOM(513)+1)=""
+4 DO WRITE^ONCSNACR(.ONCDST,TMP)
End DoDot:1
+5 QUIT