MAGDSTAX ;WOIFO/PMK - Display of CSV report for Excel ; Nov 08, 2022@13:48:26
;;3.0;IMAGING;**333**;Mar 19, 2002;Build 2
;; Per VA Directive 6402, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
; Supported IA #2056 reference $$GET1^DIQ function call
; Supported IA #10103 reference $$FMTE^XLFDT function call
; Supported IA #10103 reference $$HTE^XLFDT function call
; Supported IA #10103 reference $$FMTH^XLFDT function call
; Supported IA #10075 reference to read the OPTION file (#19)
; Supported IA #2051 reference $$FIND1^DIC function call
EXCELCSV(MYSERVICE,CSVLIST) ; output a CMP/RET comma-separated values report
N DATE,I,OUTPUT,X
S OUTPUT=0
I $$LIST^MAGDSTA0(MYSERVICE,.CSVLIST)=0 D
. W !!,"Sorry, there are no run results in Excel *.CSV file format on file"
. Q
E D
. W !!,"Output run results in Excel *.CSV file format"
. I CSVLIST(0)>1 W " -- ",CSVLIST(0)," sets of results on file"
. W !
. I CSVLIST(0)=1 D
. . S DATE=$$DATE(1)
. . W !!,"There is just one CMP/RET CSV report for a run started ",DATE,!
. . D INFO(1)
. . I $$YESNO^MAGDSTQ("Output this run?","y",.X)<0 Q
. . I X="YES" D OUTPUT(1)
. . Q
. E D
. . S I=$$SELECT() Q:I<=0
. . I I D OUTPUT(I)
. . Q
. Q
I 'OUTPUT D CONTINUE^MAGDSTQ
Q
;
SELECT() ; pick the study to output
N CHOICE,I,J,N,X
S N=CSVLIST(0)
S CHOICE=0
F D Q:CHOICE
. F I=1:1:N D
. . W !,$J(I,3)," -- ",$$DATE(I)
. . D COPY(I) W " -- ",^TMP("MAG",$J,"BATCH Q/R","OPTION")
. . W " -- ",^XTMP(CSVLIST(I),"REPORT",0)," records"
. . Q
. W !!,"Enter report number 1-",N,": "
. R J:DTIME E S J="^"
. I J["^" S CHOICE=-1 Q
. I J'?1N.N W " ??? - Please enter an integer",! Q
. I J=0 W " ??? Please enter an integer greater than zero",! Q
. I J>N W " ??? Please enter an integer no greater than ",N,! Q
. D INFO(J)
. I $$YESNO^MAGDSTQ("Output this run?","",.X)<0 Q
. I X="YES" S CHOICE=J
. Q
Q CHOICE
;
DATE(I) ; return the date of the report
N FMDT
S FMDT=$P(CSVLIST(I)," ",4)
Q $$FMTE^XLFDT(FMDT)
;
INFO(I) ;
D COPY(I)
D DISPLAY^MAGDSTA9
Q
;
COPY(I) ;
K ^TMP("MAG",$J)
M ^TMP("MAG",$J)=^XTMP(CSVLIST(I),"INFO")
Q
;
OUTPUT(I) ;
N J,OUTPUTCSV,X
W !! F J=1:1:IOM W "="
W !
W !,"For best results, set the Reflection Workplace screen width to 512:"
W !," Menu - File/Settings under Terminal Configuration 'Set Up Display Settings'"
W !," Scroll down to 'Number of characters per row', enter 512, click 'OK'",!
W !,"Specify the Logging output *.CSV file for Excel:"
W !," Menu - Tools/Logging, unselect Printer, select Disk, and enter a path"
W !," for the *.CSV file (ex. ...\Auto QR\Retrieve_2022-11-24.CSV), click 'OK'",!
W !," *** Be sure to select a different *.CVS file name for each run. ***",!
W !," Clicking on the *.CSV file will automatically launch Excel.",!
W !,"Turn on Logging:"
W !," Menu - Tools 'Start Logging'",!
W !,"Turn off Logging:"
W !," Menu - Tools 'Stop Logging'"
W !! F J=1:1:IOM W "="
W ! I $$YESNO^MAGDSTQ("To output this run, Start Logging and push <Enter>, or NO to cancel ","y",.X)<0 Q
I X="NO" W " -- output cancelled" Q
S OUTPUTCSV=CSVLIST(I)
U 0:512 W !
F J=1:1:^XTMP(OUTPUTCSV,"REPORT",0) W ^(J),!
U 0:IOM
R !!,"Stop Logging now and push <Enter>",X:DTIME
S OUTPUT=1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGDSTAX 4070 printed Mar 25, 2026@15:26:30 Page 2
MAGDSTAX ;WOIFO/PMK - Display of CSV report for Excel ; Nov 08, 2022@13:48:26
+1 ;;3.0;IMAGING;**333**;Mar 19, 2002;Build 2
+2 ;; Per VA Directive 6402, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | |
+7 ;; | The Food and Drug Administration classifies this software as |
+8 ;; | a medical device. As such, it may not be changed in any way. |
+9 ;; | Modifications to this software may result in an adulterated |
+10 ;; | medical device under 21CFR820, the use of which is considered |
+11 ;; | to be a violation of US Federal Statutes. |
+12 ;; +---------------------------------------------------------------+
+13 ;;
+14 QUIT
+15 ;
+16 ; Supported IA #2056 reference $$GET1^DIQ function call
+17 ; Supported IA #10103 reference $$FMTE^XLFDT function call
+18 ; Supported IA #10103 reference $$HTE^XLFDT function call
+19 ; Supported IA #10103 reference $$FMTH^XLFDT function call
+20 ; Supported IA #10075 reference to read the OPTION file (#19)
+21 ; Supported IA #2051 reference $$FIND1^DIC function call
EXCELCSV(MYSERVICE,CSVLIST) ; output a CMP/RET comma-separated values report
+1 NEW DATE,I,OUTPUT,X
+2 SET OUTPUT=0
+3 IF $$LIST^MAGDSTA0(MYSERVICE,.CSVLIST)=0
Begin DoDot:1
+4 WRITE !!,"Sorry, there are no run results in Excel *.CSV file format on file"
+5 QUIT
End DoDot:1
+6 IF '$TEST
Begin DoDot:1
+7 WRITE !!,"Output run results in Excel *.CSV file format"
+8 IF CSVLIST(0)>1
WRITE " -- ",CSVLIST(0)," sets of results on file"
+9 WRITE !
+10 IF CSVLIST(0)=1
Begin DoDot:2
+11 SET DATE=$$DATE(1)
+12 WRITE !!,"There is just one CMP/RET CSV report for a run started ",DATE,!
+13 DO INFO(1)
+14 IF $$YESNO^MAGDSTQ("Output this run?","y",.X)<0
QUIT
+15 IF X="YES"
DO OUTPUT(1)
+16 QUIT
End DoDot:2
+17 IF '$TEST
Begin DoDot:2
+18 SET I=$$SELECT()
if I<=0
QUIT
+19 IF I
DO OUTPUT(I)
+20 QUIT
End DoDot:2
+21 QUIT
End DoDot:1
+22 IF 'OUTPUT
DO CONTINUE^MAGDSTQ
+23 QUIT
+24 ;
SELECT() ; pick the study to output
+1 NEW CHOICE,I,J,N,X
+2 SET N=CSVLIST(0)
+3 SET CHOICE=0
+4 FOR
Begin DoDot:1
+5 FOR I=1:1:N
Begin DoDot:2
+6 WRITE !,$JUSTIFY(I,3)," -- ",$$DATE(I)
+7 DO COPY(I)
WRITE " -- ",^TMP("MAG",$JOB,"BATCH Q/R","OPTION")
+8 WRITE " -- ",^XTMP(CSVLIST(I),"REPORT",0)," records"
+9 QUIT
End DoDot:2
+10 WRITE !!,"Enter report number 1-",N,": "
+11 READ J:DTIME
IF '$TEST
SET J="^"
+12 IF J["^"
SET CHOICE=-1
QUIT
+13 IF J'?1N.N
WRITE " ??? - Please enter an integer",!
QUIT
+14 IF J=0
WRITE " ??? Please enter an integer greater than zero",!
QUIT
+15 IF J>N
WRITE " ??? Please enter an integer no greater than ",N,!
QUIT
+16 DO INFO(J)
+17 IF $$YESNO^MAGDSTQ("Output this run?","",.X)<0
QUIT
+18 IF X="YES"
SET CHOICE=J
+19 QUIT
End DoDot:1
if CHOICE
QUIT
+20 QUIT CHOICE
+21 ;
DATE(I) ; return the date of the report
+1 NEW FMDT
+2 SET FMDT=$PIECE(CSVLIST(I)," ",4)
+3 QUIT $$FMTE^XLFDT(FMDT)
+4 ;
INFO(I) ;
+1 DO COPY(I)
+2 DO DISPLAY^MAGDSTA9
+3 QUIT
+4 ;
COPY(I) ;
+1 KILL ^TMP("MAG",$JOB)
+2 MERGE ^TMP("MAG",$JOB)=^XTMP(CSVLIST(I),"INFO")
+3 QUIT
+4 ;
OUTPUT(I) ;
+1 NEW J,OUTPUTCSV,X
+2 WRITE !!
FOR J=1:1:IOM
WRITE "="
+3 WRITE !
+4 WRITE !,"For best results, set the Reflection Workplace screen width to 512:"
+5 WRITE !," Menu - File/Settings under Terminal Configuration 'Set Up Display Settings'"
+6 WRITE !," Scroll down to 'Number of characters per row', enter 512, click 'OK'",!
+7 WRITE !,"Specify the Logging output *.CSV file for Excel:"
+8 WRITE !," Menu - Tools/Logging, unselect Printer, select Disk, and enter a path"
+9 WRITE !," for the *.CSV file (ex. ...\Auto QR\Retrieve_2022-11-24.CSV), click 'OK'",!
+10 WRITE !," *** Be sure to select a different *.CVS file name for each run. ***",!
+11 WRITE !," Clicking on the *.CSV file will automatically launch Excel.",!
+12 WRITE !,"Turn on Logging:"
+13 WRITE !," Menu - Tools 'Start Logging'",!
+14 WRITE !,"Turn off Logging:"
+15 WRITE !," Menu - Tools 'Stop Logging'"
+16 WRITE !!
FOR J=1:1:IOM
WRITE "="
+17 WRITE !
IF $$YESNO^MAGDSTQ("To output this run, Start Logging and push <Enter>, or NO to cancel ","y",.X)<0
QUIT
+18 IF X="NO"
WRITE " -- output cancelled"
QUIT
+19 SET OUTPUTCSV=CSVLIST(I)
+20 USE 0:512
WRITE !
+21 FOR J=1:1:^XTMP(OUTPUTCSV,"REPORT",0)
WRITE ^(J),!
+22 USE 0:IOM
+23 READ !!,"Stop Logging now and push <Enter>",X:DTIME
+24 SET OUTPUT=1
+25 QUIT