MAGSIXG1 ;WOIFO/EDM/GEK/SEB/SG/NST/ZEB - LIST OF IMAGES RPCS ; JUN 11, 2018@11:43 AM
;;3.0;IMAGING;**8,48,59,93,117,221,365**;Mar 19, 2002;Build 19;Jul 15, 2011
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | 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
;
;+++++ FORMATS RPC ERRORS
ERRORS(RESULTS,RC) ;
S:$G(RC)'<0 RC=$$FIRSTERR^MAGUERR1()
D RPCERRS^MAGUERR1(.RESULTS,RC)
Q
;
;***** RETURNS THE LIST OF IMAGE DESCRIPTORS
; RPC: MAG4 IMAGE LIST
;
; .MAGOUT Reference to a local variable where the results
; are returned to.
;
; FLAGS Flags that control the execution (can be combined):
;
; C Capture date range. If this flag is provided,
; then the remote procedure uses values of the
; FROMDATE and TODATE parameters to select images
; that were captured in this date range.
;
; Otherwise, values of those parameters are
; treated as the date range when procedures were
; performed.
;
; D Include only deleted images (file #2005.1)
; E Include only existing images (file #2005)
;
; S Return the sparse subset of images captured by
; the user defined by the MISCPRMS("SAVEDBY").
; The latter becomes required in this case.
;
; G Include Group Images in the list of images returned.
; If any image in a group has an image that matches the
; status provided in the search criteria then
; the group will be returned.
;
; If the G flag is not set then only the status of the
; Group entry will be checked and the group will be
; returned if it passes.
;
; O Omit non-printable and delimiter characters from the
; SHORT DESCRIPTION field
;
; See description of the MAG4 IMAGE LIST remote
; procedure for details.
;
; If neither 'E' nor 'D' flag is provided, then an
; error code is returned.
;
; [FROMDATE] Date range for image selection. Dates can be in
; [TODATE] internal or external FileMan format. If a date
; parameter is not defined or empty, then the date
; range remains open on the corresponding side.
;
; Time parts of parameter values are ignored and both
; ends of the date range are included in the search.
; For example, in order to search images for May 21,
; 2008, the internal value of both parameters should
; be 3080521.
;
; If the FROMDATE is after the TODATE, then values of
; the parameters are swapped.
;
; [MAXNUM] If this parameter is defined and greater than 0,
; then it determines the maximum number of images
; returned by the call.
;
; If the S flag is included in the value of the FLAGS
; parameter, then the MAXNUM parameter must be defined
; and greater than 0. Its value determines percentage
; of preselected images to be returned in the result
; array.
;
; See description of the MAG4 IMAGE LIST remote
; procedure for details.
;
; [.MISCPRMS] Reference to a local variable that stores misc.
; parameters that define the image selection criteria.
; See the description of the MAG4 IMAGE LIST remote
; procedure for details.
;
; Return Values
; =============
;
; If MAGOUT(0) is defined and its 1st '^'-piece is 0, then an error
; occurred during execution of the procedure. In this case, the array
; is formatted as described in the comments to the RPCERRS^MAGUERR1.
;
; See description of the MAG4 IMAGE LIST remote procedure for more
; details.
;
; Notes
; =====
;
; Temporary global nodes ^TMP("MAGSIX1",$J) and ^TMP("MAGSIXG3",$J)
; are used by this procedure.
;
; If the number of images conforming to the filter reaches 76, all
; results are stored in the ^TMP("MAGSIXG1",$J) global node, closed
; reference is assigned to the MAGOUT parameter, and the type of the
; RPC return parameter is changed to 'GLOBAL ARRAY'.
;
GETIMGS(MAGOUT,FLAGS,FROMDATE,TODATE,MAXNUM,MISCPRMS) ;RPC [MAG4 IMAGE LIST]
N MAGDATA ; Array for passing the data to the callback
; ; function of the image query (including the
; ; image selection criteria).
;
N ERROR,MISC,QF,RC,TMP
S (MAGDATA("RESCNT"),RC)=0,MAGDATA="MAGOUT" K MAGOUT
D CLEAR^MAGUERR(1),NETPLCS^MAGGTU6
K ^TMP("MAGSIXG3",$J)
;
S MAXNUM=$G(MAXNUM)
;=== Validate parameters
S ERROR=$$VALPARAM(.MAGDATA,FLAGS,.FROMDATE,.TODATE,MAXNUM,.MISCPRMS)
;
;--- Check for errors
I ERROR D ERROR^MAGUERR(-30),ERRORS(.MAGOUT) Q
;
S MAXNUM=+$G(MAXNUM)
;
;=== Query the image file(s)
S MAGDATA("FLAGS")=FLAGS,MAGDATA("MAXNUM")=MAXNUM
S TMP=$S(TODATE<9999999:$$FMADD^XLFDT(TODATE,1),1:TODATE)
;*zeb *365 add support for O flag
S QF=$$TRFLAGS^MAGUTL05(FLAGS,"CDEGO")
S RC=$$QUERY^MAGGI13("$$QRYCBK^MAGSIXG3",QF,.MAGDATA,FROMDATE,TMP,+$G(MAGDATA("IDFN")))
I RC<0 D ERRORS(.MAGOUT,RC) Q
;
;=== Post-processing for the sparse subset query
I FLAGS["S" D I RC<0 D ERRORS(.MAGOUT,RC) Q
. S RC=$$SUBSET^MAGSIXG4()
. Q
;
;=== Cleanup
K ^TMP("MAGSIXG3",$J)
S TMP=$$FLTDESC^MAGSIXG2(.MAGDATA,FROMDATE(0),TODATE(0),FLAGS)
I 'MAGDATA("RESCNT") D ERRORS(.MAGOUT,$$ERROR^MAGUERR(-19,,TMP)) Q
S @MAGDATA@(0)="1^"_TMP_$S($G(MAGDATA("MAXNUM")):U_(RC>0),1:"")
S @MAGDATA@(1)=$$BLDHDR^MAGSIXG2()
Q
;
;***** GET IMAGES FOR THE PATIENT
; RPC: MAG4 PAT GET IMAGES
;
; .MAGOUT Reference to a local variable where the results
; are returned to.
;
; DFN Patient IEN (DFN)
;
; [PKG] Package index(es)
; [CLASS] Class index(es)
; [TYPE] Type index(es)
; [EVENT] Procedure/Event index(es)
; [SPEC] Speciality/SubSpecialty index(es)
;
; [FROMDATE] Date range for image selection. See description
; [TODATE] of the GETIMGS^MAGSIXG1 entry point for details.
;
; [ORIGIN] Origin index(es)
;
; [DATA] Reserved for future use.
;
; [FLAGS] Flags that control the execution (can be combined):
;
; D Include only deleted images (file #2005.1)
; E Include only existing images (file #2005)
; O Omit non-printable and delimiter characters from SHORT DESCRIPTION
;
; By default ($G(FLAGS)=""), the "E" value is assumed.
;
; Return Values
; =============
;
; See description of the MAG4 PAT GET IMAGES remote procedure.
;
PGI(MAGOUT,DFN,PKG,CLASS,TYPE,EVENT,SPEC,FROMDATE,TODATE,ORIGIN,DATA,FLAGS) ;RPC [MAG4 PAT GET IMAGES]
N I,MISCPRMS
K MAGOUT S I=0
;--- Check the patient IEN (DFN)
I $G(DFN)'>0 D ERRORS(.MAGOUT,$$IPVE^MAGUERR("DFN")) Q
S I=I+1,MISCPRMS(I)="IDFN^^"_(+DFN)
;--- Check the flags
;*zeb *365 add support for O flag
S FLAGS=$G(FLAGS)
I (FLAGS'["D"),(FLAGS'["E") S FLAGS="E"_FLAGS
I $TR(FLAGS,"DEO")'="" D ERRORS(.MAGOUT,$$IPVE^MAGUERR("FLAGS")) Q
;--- Pass the filter parameters through
S:$G(PKG)'="" I=I+1,MISCPRMS(I)="IXPKG^^"_$TR(PKG,",","^")
S:$G(CLASS)'="" I=I+1,MISCPRMS(I)="IXCLASS^^"_$TR(CLASS,",","^")
S:$G(TYPE)'="" I=I+1,MISCPRMS(I)="IXTYPE^^"_$TR(TYPE,",","^")
S:$G(EVENT)'="" I=I+1,MISCPRMS(I)="IXPROC^^"_$TR(EVENT,",","^")
S:$G(SPEC)'="" I=I+1,MISCPRMS(I)="IXSPEC^^"_$TR(SPEC,",","^")
S:$G(ORIGIN)'="" I=I+1,MISCPRMS(I)="IXORIGIN^^"_$TR(ORIGIN,",","^")
;--- Call the new remote procedure implementation
D GETIMGS(.MAGOUT,FLAGS,.FROMDATE,.TODATE,,.MISCPRMS)
Q
;
VALPARAM(MAGDATA,FLAGS,FROMDATE,TODATE,MAXNUM,MISCPRMS) ; Validate input parameters
N ERROR,MISC,MISCDEFS,RC,TMP
;--- Control flags
S ERROR=0
S FLAGS=$G(FLAGS)
;*zeb *365 add support for O flag
I $TR(FLAGS,"CDESGO")'="" D S ERROR=1
. D IPVE^MAGUERR("FLAGS") ; Unknown/Unsupported flag(s)
. Q
I $TR(FLAGS,"DE")=FLAGS D S ERROR=1
. D ERROR^MAGUERR(-6,,"D,E") ; Missing required flag
. Q
;--- Date range
S:$$DTRANGE^MAGUTL03(.FROMDATE,.TODATE)<0 ERROR=1
;--- Miscellaneous parameters
S RC=$$LDMPDEFS^MAGUTL01(.MISCDEFS,"MISCDEFS^MAGSIXG2")
I RC<0 S ERROR=1 Q
S RC=$$RPCMISC^MAGUTL02(.MISCPRMS,.MISC,.MISCDEFS,"UV")
I RC<0 S ERROR=1 Q
S:$$VALMISC^MAGSIXG2(.MISC,.MAGDATA)<0 ERROR=1
;--- Number/percentage of results
I $G(MAXNUM)<0 D
. D IPVE^MAGUERR("MAXNUM") S ERROR=1
. Q
E I FLAGS["S" D
. ;--- Check the percentage
. S TMP=+$G(MAXNUM)
. I 'TMP!(TMP>100) D IPVE^MAGUERR("MAXNUM") S ERROR=1 Q
. S MAGDATA("SUBSET%")=TMP,MAXNUM=0
. ;--- User filter is required for this query
. S TMP=$NA(MAGDATA("SAVEDBY"))
. I $G(@TMP)'>0 D ERROR^MAGUERR(-8,,TMP) S ERROR=1 Q
. Q
;
Q ERROR
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGSIXG1 10232 printed May 25, 2026@12:12:30 Page 2
MAGSIXG1 ;WOIFO/EDM/GEK/SEB/SG/NST/ZEB - LIST OF IMAGES RPCS ; JUN 11, 2018@11:43 AM
+1 ;;3.0;IMAGING;**8,48,59,93,117,221,365**;Mar 19, 2002;Build 19;Jul 15, 2011
+2 ;; Per VHA Directive 2004-038, 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 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ;
+19 ;+++++ FORMATS RPC ERRORS
ERRORS(RESULTS,RC) ;
+1 if $GET(RC)'<0
SET RC=$$FIRSTERR^MAGUERR1()
+2 DO RPCERRS^MAGUERR1(.RESULTS,RC)
+3 QUIT
+4 ;
+5 ;***** RETURNS THE LIST OF IMAGE DESCRIPTORS
+6 ; RPC: MAG4 IMAGE LIST
+7 ;
+8 ; .MAGOUT Reference to a local variable where the results
+9 ; are returned to.
+10 ;
+11 ; FLAGS Flags that control the execution (can be combined):
+12 ;
+13 ; C Capture date range. If this flag is provided,
+14 ; then the remote procedure uses values of the
+15 ; FROMDATE and TODATE parameters to select images
+16 ; that were captured in this date range.
+17 ;
+18 ; Otherwise, values of those parameters are
+19 ; treated as the date range when procedures were
+20 ; performed.
+21 ;
+22 ; D Include only deleted images (file #2005.1)
+23 ; E Include only existing images (file #2005)
+24 ;
+25 ; S Return the sparse subset of images captured by
+26 ; the user defined by the MISCPRMS("SAVEDBY").
+27 ; The latter becomes required in this case.
+28 ;
+29 ; G Include Group Images in the list of images returned.
+30 ; If any image in a group has an image that matches the
+31 ; status provided in the search criteria then
+32 ; the group will be returned.
+33 ;
+34 ; If the G flag is not set then only the status of the
+35 ; Group entry will be checked and the group will be
+36 ; returned if it passes.
+37 ;
+38 ; O Omit non-printable and delimiter characters from the
+39 ; SHORT DESCRIPTION field
+40 ;
+41 ; See description of the MAG4 IMAGE LIST remote
+42 ; procedure for details.
+43 ;
+44 ; If neither 'E' nor 'D' flag is provided, then an
+45 ; error code is returned.
+46 ;
+47 ; [FROMDATE] Date range for image selection. Dates can be in
+48 ; [TODATE] internal or external FileMan format. If a date
+49 ; parameter is not defined or empty, then the date
+50 ; range remains open on the corresponding side.
+51 ;
+52 ; Time parts of parameter values are ignored and both
+53 ; ends of the date range are included in the search.
+54 ; For example, in order to search images for May 21,
+55 ; 2008, the internal value of both parameters should
+56 ; be 3080521.
+57 ;
+58 ; If the FROMDATE is after the TODATE, then values of
+59 ; the parameters are swapped.
+60 ;
+61 ; [MAXNUM] If this parameter is defined and greater than 0,
+62 ; then it determines the maximum number of images
+63 ; returned by the call.
+64 ;
+65 ; If the S flag is included in the value of the FLAGS
+66 ; parameter, then the MAXNUM parameter must be defined
+67 ; and greater than 0. Its value determines percentage
+68 ; of preselected images to be returned in the result
+69 ; array.
+70 ;
+71 ; See description of the MAG4 IMAGE LIST remote
+72 ; procedure for details.
+73 ;
+74 ; [.MISCPRMS] Reference to a local variable that stores misc.
+75 ; parameters that define the image selection criteria.
+76 ; See the description of the MAG4 IMAGE LIST remote
+77 ; procedure for details.
+78 ;
+79 ; Return Values
+80 ; =============
+81 ;
+82 ; If MAGOUT(0) is defined and its 1st '^'-piece is 0, then an error
+83 ; occurred during execution of the procedure. In this case, the array
+84 ; is formatted as described in the comments to the RPCERRS^MAGUERR1.
+85 ;
+86 ; See description of the MAG4 IMAGE LIST remote procedure for more
+87 ; details.
+88 ;
+89 ; Notes
+90 ; =====
+91 ;
+92 ; Temporary global nodes ^TMP("MAGSIX1",$J) and ^TMP("MAGSIXG3",$J)
+93 ; are used by this procedure.
+94 ;
+95 ; If the number of images conforming to the filter reaches 76, all
+96 ; results are stored in the ^TMP("MAGSIXG1",$J) global node, closed
+97 ; reference is assigned to the MAGOUT parameter, and the type of the
+98 ; RPC return parameter is changed to 'GLOBAL ARRAY'.
+99 ;
GETIMGS(MAGOUT,FLAGS,FROMDATE,TODATE,MAXNUM,MISCPRMS) ;RPC [MAG4 IMAGE LIST]
+1 ; Array for passing the data to the callback
NEW MAGDATA
+2 ; ; function of the image query (including the
+3 ; ; image selection criteria).
+4 ;
+5 NEW ERROR,MISC,QF,RC,TMP
+6 SET (MAGDATA("RESCNT"),RC)=0
SET MAGDATA="MAGOUT"
KILL MAGOUT
+7 DO CLEAR^MAGUERR(1)
DO NETPLCS^MAGGTU6
+8 KILL ^TMP("MAGSIXG3",$JOB)
+9 ;
+10 SET MAXNUM=$GET(MAXNUM)
+11 ;=== Validate parameters
+12 SET ERROR=$$VALPARAM(.MAGDATA,FLAGS,.FROMDATE,.TODATE,MAXNUM,.MISCPRMS)
+13 ;
+14 ;--- Check for errors
+15 IF ERROR
DO ERROR^MAGUERR(-30)
DO ERRORS(.MAGOUT)
QUIT
+16 ;
+17 SET MAXNUM=+$GET(MAXNUM)
+18 ;
+19 ;=== Query the image file(s)
+20 SET MAGDATA("FLAGS")=FLAGS
SET MAGDATA("MAXNUM")=MAXNUM
+21 SET TMP=$SELECT(TODATE<9999999:$$FMADD^XLFDT(TODATE,1),1:TODATE)
+22 ;*zeb *365 add support for O flag
+23 SET QF=$$TRFLAGS^MAGUTL05(FLAGS,"CDEGO")
+24 SET RC=$$QUERY^MAGGI13("$$QRYCBK^MAGSIXG3",QF,.MAGDATA,FROMDATE,TMP,+$GET(MAGDATA("IDFN")))
+25 IF RC<0
DO ERRORS(.MAGOUT,RC)
QUIT
+26 ;
+27 ;=== Post-processing for the sparse subset query
+28 IF FLAGS["S"
Begin DoDot:1
+29 SET RC=$$SUBSET^MAGSIXG4()
+30 QUIT
End DoDot:1
IF RC<0
DO ERRORS(.MAGOUT,RC)
QUIT
+31 ;
+32 ;=== Cleanup
+33 KILL ^TMP("MAGSIXG3",$JOB)
+34 SET TMP=$$FLTDESC^MAGSIXG2(.MAGDATA,FROMDATE(0),TODATE(0),FLAGS)
+35 IF 'MAGDATA("RESCNT")
DO ERRORS(.MAGOUT,$$ERROR^MAGUERR(-19,,TMP))
QUIT
+36 SET @MAGDATA@(0)="1^"_TMP_$SELECT($GET(MAGDATA("MAXNUM")):U_(RC>0),1:"")
+37 SET @MAGDATA@(1)=$$BLDHDR^MAGSIXG2()
+38 QUIT
+39 ;
+40 ;***** GET IMAGES FOR THE PATIENT
+41 ; RPC: MAG4 PAT GET IMAGES
+42 ;
+43 ; .MAGOUT Reference to a local variable where the results
+44 ; are returned to.
+45 ;
+46 ; DFN Patient IEN (DFN)
+47 ;
+48 ; [PKG] Package index(es)
+49 ; [CLASS] Class index(es)
+50 ; [TYPE] Type index(es)
+51 ; [EVENT] Procedure/Event index(es)
+52 ; [SPEC] Speciality/SubSpecialty index(es)
+53 ;
+54 ; [FROMDATE] Date range for image selection. See description
+55 ; [TODATE] of the GETIMGS^MAGSIXG1 entry point for details.
+56 ;
+57 ; [ORIGIN] Origin index(es)
+58 ;
+59 ; [DATA] Reserved for future use.
+60 ;
+61 ; [FLAGS] Flags that control the execution (can be combined):
+62 ;
+63 ; D Include only deleted images (file #2005.1)
+64 ; E Include only existing images (file #2005)
+65 ; O Omit non-printable and delimiter characters from SHORT DESCRIPTION
+66 ;
+67 ; By default ($G(FLAGS)=""), the "E" value is assumed.
+68 ;
+69 ; Return Values
+70 ; =============
+71 ;
+72 ; See description of the MAG4 PAT GET IMAGES remote procedure.
+73 ;
PGI(MAGOUT,DFN,PKG,CLASS,TYPE,EVENT,SPEC,FROMDATE,TODATE,ORIGIN,DATA,FLAGS) ;RPC [MAG4 PAT GET IMAGES]
+1 NEW I,MISCPRMS
+2 KILL MAGOUT
SET I=0
+3 ;--- Check the patient IEN (DFN)
+4 IF $GET(DFN)'>0
DO ERRORS(.MAGOUT,$$IPVE^MAGUERR("DFN"))
QUIT
+5 SET I=I+1
SET MISCPRMS(I)="IDFN^^"_(+DFN)
+6 ;--- Check the flags
+7 ;*zeb *365 add support for O flag
+8 SET FLAGS=$GET(FLAGS)
+9 IF (FLAGS'["D")
IF (FLAGS'["E")
SET FLAGS="E"_FLAGS
+10 IF $TRANSLATE(FLAGS,"DEO")'=""
DO ERRORS(.MAGOUT,$$IPVE^MAGUERR("FLAGS"))
QUIT
+11 ;--- Pass the filter parameters through
+12 if $GET(PKG)'=""
SET I=I+1
SET MISCPRMS(I)="IXPKG^^"_$TRANSLATE(PKG,",","^")
+13 if $GET(CLASS)'=""
SET I=I+1
SET MISCPRMS(I)="IXCLASS^^"_$TRANSLATE(CLASS,",","^")
+14 if $GET(TYPE)'=""
SET I=I+1
SET MISCPRMS(I)="IXTYPE^^"_$TRANSLATE(TYPE,",","^")
+15 if $GET(EVENT)'=""
SET I=I+1
SET MISCPRMS(I)="IXPROC^^"_$TRANSLATE(EVENT,",","^")
+16 if $GET(SPEC)'=""
SET I=I+1
SET MISCPRMS(I)="IXSPEC^^"_$TRANSLATE(SPEC,",","^")
+17 if $GET(ORIGIN)'=""
SET I=I+1
SET MISCPRMS(I)="IXORIGIN^^"_$TRANSLATE(ORIGIN,",","^")
+18 ;--- Call the new remote procedure implementation
+19 DO GETIMGS(.MAGOUT,FLAGS,.FROMDATE,.TODATE,,.MISCPRMS)
+20 QUIT
+21 ;
VALPARAM(MAGDATA,FLAGS,FROMDATE,TODATE,MAXNUM,MISCPRMS) ; Validate input parameters
+1 NEW ERROR,MISC,MISCDEFS,RC,TMP
+2 ;--- Control flags
+3 SET ERROR=0
+4 SET FLAGS=$GET(FLAGS)
+5 ;*zeb *365 add support for O flag
+6 IF $TRANSLATE(FLAGS,"CDESGO")'=""
Begin DoDot:1
+7 ; Unknown/Unsupported flag(s)
DO IPVE^MAGUERR("FLAGS")
+8 QUIT
End DoDot:1
SET ERROR=1
+9 IF $TRANSLATE(FLAGS,"DE")=FLAGS
Begin DoDot:1
+10 ; Missing required flag
DO ERROR^MAGUERR(-6,,"D,E")
+11 QUIT
End DoDot:1
SET ERROR=1
+12 ;--- Date range
+13 if $$DTRANGE^MAGUTL03(.FROMDATE,.TODATE)<0
SET ERROR=1
+14 ;--- Miscellaneous parameters
+15 SET RC=$$LDMPDEFS^MAGUTL01(.MISCDEFS,"MISCDEFS^MAGSIXG2")
+16 IF RC<0
SET ERROR=1
QUIT
+17 SET RC=$$RPCMISC^MAGUTL02(.MISCPRMS,.MISC,.MISCDEFS,"UV")
+18 IF RC<0
SET ERROR=1
QUIT
+19 if $$VALMISC^MAGSIXG2(.MISC,.MAGDATA)<0
SET ERROR=1
+20 ;--- Number/percentage of results
+21 IF $GET(MAXNUM)<0
Begin DoDot:1
+22 DO IPVE^MAGUERR("MAXNUM")
SET ERROR=1
+23 QUIT
End DoDot:1
+24 IF '$TEST
IF FLAGS["S"
Begin DoDot:1
+25 ;--- Check the percentage
+26 SET TMP=+$GET(MAXNUM)
+27 IF 'TMP!(TMP>100)
DO IPVE^MAGUERR("MAXNUM")
SET ERROR=1
QUIT
+28 SET MAGDATA("SUBSET%")=TMP
SET MAXNUM=0
+29 ;--- User filter is required for this query
+30 SET TMP=$NAME(MAGDATA("SAVEDBY"))
+31 IF $GET(@TMP)'>0
DO ERROR^MAGUERR(-8,,TMP)
SET ERROR=1
QUIT
+32 QUIT
End DoDot:1
+33 ;
+34 QUIT ERROR