BISELEC2 ;IHS/CMI/MWR - GENERIC SELECTION UTILITY; MAY 10, 2010
;;8.5;IMMUNIZATION;;SEP 01,2011
;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
;; ADD AND DELETE ITEMS IN THE SELECTION ARRAY.
;
;
;----------
ADDITEM ;EP
;---> Add an Item to the Selection Array via List Manager.
;---> Steps:
; 1) This entry point is called by the Protocol:
; BI GEN SELECT ADD, an action on the List Manager
; menu protocol: BI MENU GEN SELECT.
;
; 2) This code calls ^DIC for the user to lookup and
; and select Items in the file/global @BIGBL.
;
; 3) The IEN of the selected Item is then stored as
; as a subscript in the Selection Array, @BIARR1.
;
Q:$$CHECK^BISELECT()
;
;---> Call to select Item from File.
N BIART S BIART=$S("AEIOU"[$E(BIITEM):"an ",1:"a ")
D FULL^VALM1,TITLE^BIUTL5("Select "_BIART_BIITEM)
;
;---> Checks.
I '$G(BIFILE) D ERRCD^BIUTL2(607,,1) Q
I '$D(^DD(BIFILE)) D ERRCD^BIUTL2(608,,1) Q
I '$D(@(BIGBL_"0)")) D ERRCD^BIUTL2(601,,1) Q
;
N Y
D
.;---> If this is a Set of Codes, make selection and quit.
.I $G(BIFLD) D Q
..N BISET S BISET=$P(^DD(BIFILE,BIFLD,0),U,3)
..D DIR^BIFMAN("SOM"_U_BISET,.Y) ;," Select "_BIITEM_": ")
..;---> Set selected Item IEN into Selection Array.
..S:((Y'="")&(Y'="^")) @(BIARR1_"(Y)")=""
.;
.;---> Select from a File.
.D DIC^BIFMAN(BIGBL,"QEMA",.Y," Select "_BIITEM_": ",,BISCRN)
.;---> Set selected Item IEN into Selection Array.
.S:+Y>0 @(BIARR1_"(+Y)")=""
;
D RESET^BISELEC1
Q
;
;
;----------
ENTIRE ;EP
;---> Add Entire File of Items or Set of Codes to the Selection Array.
;---> Steps:
; 1) This entry point is called by the Protocol:
; BI GEN SELECT ENTIRE, an action on the List Manager
; menu protocol: BI MENU GEN SELECT.
;
; 2) If BIFIELD (a Field#) exists, load the entire Set of Codes.
; If the selection is from a File, this code evaluates the size
; of the entire global and determines if it is >300 entries.
; If so, then it returns @BIARR1("ALL") and quits Listmanager.
;
; 3) If the entire global is <300 entries, this code
; loops through the file global, evaluating entries
; against the screen, if there is a screen.
;
; 4) The IEN of each Item is then stored as
; as a subscript in the Selection Array, @BIARR1.
;
Q:$$CHECK^BISELECT()
K @(BIARR1)
S @(BIARR1_"(""ALL"")")=""
;
D
.;---> If this is a Set of Codes, set all Codes in Selection Array and quit.
.I $G(BIFLD) D Q
..N BISET S BISET=$P(^DD(BIFILE,BIFLD,0),U,3)
..N I,X
..F I=1:1 S X=$P(BISET,";",I) Q:X="" D
...N Y S Y=$P(X,":") S:Y]"" @(BIARR1_"(Y)")=""
.;
.;---> This is a selection from a File.
.;---> If entire file is too large for local partition,
.;---> do ENTIRE1 and quit.
.I $P(@(BIGBL_"0)"),U,4)>300 D ENTIRE1 Q
.;
.;---> Entire file is small enough to store and display locally.
.;---> Load each entry into Selection Array for review.
.;---> Screen, if there is one, applies.
.;
.;
.N BIIEN,I S BIIEN=0
.F I=1:1 S BIIEN=$O(@(BIGBL_"BIIEN)")) Q:'BIIEN Q:I>300 D
..;---> Check screen.
..I BISCRN]"" N Y S Y=BIIEN X BISCRN Q:'$T
..;
..;---> Set Item IEN into Selection Array.
..S @(BIARR1_"(BIIEN)")=""
.;
.;---> Global had more than 300 entries.
.I I>300 D ENTIRE1 Q
;
D RESET^BISELEC1
Q
;
;
;----------
ENTIRE1 ;EP
;---> Entire file of Items is too large to load and display
;---> in local partition.
;---> Set BIARR1("ALL"), inform user, tell Listman to quit.
;---> NOTE: A Screen will not apply here. See documentation
;---> top of ^BISELECT.
;
;
D FULL^VALM1,TITLE^BIUTL5("Select Entire File of "_BIITEMS)
W !!!?8,"NOTE: This file is too large to load for screen selection."
W !?14,"Instead, the entire file (ALL Items) have been selected"
W !?14,"automatically.",!!
D DIRZ^BIUTL3()
K @(BIARR1)
S @(BIARR1_"(""ALL"")")=""
S VALMBCK="Q"
S VALMQUIT=""
Q
;
;
;----------
DELITEM ;EP
;---> Delete an Item from the Selection Array via List Manager.
;---> Steps:
; 1) This entry point is called by the Protocol:
; BI GEN SELECT DELETE, an action on the List Manager
; menu protocol: BI MENU GEN SELECT.
;
; 2) This code gets an Item from Listmanager and
; deletes the Item from the Selection Array and the
; ^TMP global.
;
Q:$$CHECK^BISELECT()
;
;---> Call the Listmanager Generic Selector of Items displayed.
N VALMY
D EN^VALM2(XQORNOD(0),"OS")
;
;---> Check that a Listman Item was passed.
I '$D(VALMY) D ERRCD^BIUTL2(406,,1) D RESET^BISELEC1 Q
N Y S Y=$O(VALMY(0))
I '$G(Y) D ERRCD^BIUTL2(406,,1) D RESET^BISELEC1 Q
;
;---> Now set Y=IEN of the Item to delete in the BIARR1 local array.
S Y=$P($G(^TMP("BILMGS2",$J,Y)),U)
I Y="" D ERRCD^BIUTL2(604,,1) D RESET^BISELEC1 Q
;
;---> If ALL/ENTIRE was previously selected, it is no longer valid,
;---> so kill it.
K @(BIARR1_"(""ALL"")")
;---> Delete the Item from the Selection Array.
K @(BIARR1_"(Y)")
S BIPOP=""
;
D RESET^BISELEC1
Q
;
;
;----------
CLEARALL ;EP
;---> Clear/Delete ALL Items from the Selection Array.
;---> Steps:
; 1) This entry point is called by the Protocol:
; BI GEN SELECT CLEAR ALL, an action on the List Manager
; menu protocol: BI MENU GEN SELECT.
;
; 2) This code deletes ALL Items from Listmanager and
; from the Selection Array and ^TMP global.
;
Q:$$CHECK^BISELECT()
;
;---> Delete the Item from the Selection Array.
K @(BIARR1)
K ^TMP("BILMGS",$J),^TMP("BILMGS1",$J),^TMP("BILMGS2",$J)
;
D RESET^BISELEC1
Q
BISELEC2 ;IHS/CMI/MWR - GENERIC SELECTION UTILITY; MAY 10, 2010
+1 ;;8.5;IMMUNIZATION;;SEP 01,2011
+2 ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
+3 ;; ADD AND DELETE ITEMS IN THE SELECTION ARRAY.
+4 ;
+5 ;
+6 ;----------
ADDITEM ;EP
+1 ;---> Add an Item to the Selection Array via List Manager.
+2 ;---> Steps:
+3 ; 1) This entry point is called by the Protocol:
+4 ; BI GEN SELECT ADD, an action on the List Manager
+5 ; menu protocol: BI MENU GEN SELECT.
+6 ;
+7 ; 2) This code calls ^DIC for the user to lookup and
+8 ; and select Items in the file/global @BIGBL.
+9 ;
+10 ; 3) The IEN of the selected Item is then stored as
+11 ; as a subscript in the Selection Array, @BIARR1.
+12 ;
+13 IF $$CHECK^BISELECT()
QUIT
+14 ;
+15 ;---> Call to select Item from File.
+16 NEW BIART
SET BIART=$SELECT("AEIOU"[$EXTRACT(BIITEM):"an ",1:"a ")
+17 DO FULL^VALM1
DO TITLE^BIUTL5("Select "_BIART_BIITEM)
+18 ;
+19 ;---> Checks.
+20 IF '$GET(BIFILE)
DO ERRCD^BIUTL2(607,,1)
QUIT
+21 IF '$DATA(^DD(BIFILE))
DO ERRCD^BIUTL2(608,,1)
QUIT
+22 IF '$DATA(@(BIGBL_"0)"))
DO ERRCD^BIUTL2(601,,1)
QUIT
+23 ;
+24 NEW Y
+25 Begin DoDot:1
+26 ;---> If this is a Set of Codes, make selection and quit.
+27 IF $GET(BIFLD)
Begin DoDot:2
+28 NEW BISET
SET BISET=$PIECE(^DD(BIFILE,BIFLD,0),U,3)
+29 ;," Select "_BIITEM_": ")
DO DIR^BIFMAN("SOM"_U_BISET,.Y)
+30 ;---> Set selected Item IEN into Selection Array.
+31 IF ((Y'="")&(Y'="^"))
SET @(BIARR1_"(Y)")=""
End DoDot:2
QUIT
+32 ;
+33 ;---> Select from a File.
+34 DO DIC^BIFMAN(BIGBL,"QEMA",.Y," Select "_BIITEM_": ",,BISCRN)
+35 ;---> Set selected Item IEN into Selection Array.
+36 IF +Y>0
SET @(BIARR1_"(+Y)")=""
End DoDot:1
+37 ;
+38 DO RESET^BISELEC1
+39 QUIT
+40 ;
+41 ;
+42 ;----------
ENTIRE ;EP
+1 ;---> Add Entire File of Items or Set of Codes to the Selection Array.
+2 ;---> Steps:
+3 ; 1) This entry point is called by the Protocol:
+4 ; BI GEN SELECT ENTIRE, an action on the List Manager
+5 ; menu protocol: BI MENU GEN SELECT.
+6 ;
+7 ; 2) If BIFIELD (a Field#) exists, load the entire Set of Codes.
+8 ; If the selection is from a File, this code evaluates the size
+9 ; of the entire global and determines if it is >300 entries.
+10 ; If so, then it returns @BIARR1("ALL") and quits Listmanager.
+11 ;
+12 ; 3) If the entire global is <300 entries, this code
+13 ; loops through the file global, evaluating entries
+14 ; against the screen, if there is a screen.
+15 ;
+16 ; 4) The IEN of each Item is then stored as
+17 ; as a subscript in the Selection Array, @BIARR1.
+18 ;
+19 IF $$CHECK^BISELECT()
QUIT
+20 KILL @(BIARR1)
+21 SET @(BIARR1_"(""ALL"")")=""
+22 ;
+23 Begin DoDot:1
+24 ;---> If this is a Set of Codes, set all Codes in Selection Array and quit.
+25 IF $GET(BIFLD)
Begin DoDot:2
+26 NEW BISET
SET BISET=$PIECE(^DD(BIFILE,BIFLD,0),U,3)
+27 NEW I,X
+28 FOR I=1:1
SET X=$PIECE(BISET,";",I)
IF X=""
QUIT
Begin DoDot:3
+29 NEW Y
SET Y=$PIECE(X,":")
IF Y]""
SET @(BIARR1_"(Y)")=""
End DoDot:3
End DoDot:2
QUIT
+30 ;
+31 ;---> This is a selection from a File.
+32 ;---> If entire file is too large for local partition,
+33 ;---> do ENTIRE1 and quit.
+34 IF $PIECE(@(BIGBL_"0)"),U,4)>300
DO ENTIRE1
QUIT
+35 ;
+36 ;---> Entire file is small enough to store and display locally.
+37 ;---> Load each entry into Selection Array for review.
+38 ;---> Screen, if there is one, applies.
+39 ;
+40 ;
+41 NEW BIIEN,I
SET BIIEN=0
+42 FOR I=1:1
SET BIIEN=$ORDER(@(BIGBL_"BIIEN)"))
IF 'BIIEN
QUIT
IF I>300
QUIT
Begin DoDot:2
+43 ;---> Check screen.
+44 IF BISCRN]""
NEW Y
SET Y=BIIEN
XECUTE BISCRN
IF '$TEST
QUIT
+45 ;
+46 ;---> Set Item IEN into Selection Array.
+47 SET @(BIARR1_"(BIIEN)")=""
End DoDot:2
+48 ;
+49 ;---> Global had more than 300 entries.
+50 IF I>300
DO ENTIRE1
QUIT
End DoDot:1
+51 ;
+52 DO RESET^BISELEC1
+53 QUIT
+54 ;
+55 ;
+56 ;----------
ENTIRE1 ;EP
+1 ;---> Entire file of Items is too large to load and display
+2 ;---> in local partition.
+3 ;---> Set BIARR1("ALL"), inform user, tell Listman to quit.
+4 ;---> NOTE: A Screen will not apply here. See documentation
+5 ;---> top of ^BISELECT.
+6 ;
+7 ;
+8 DO FULL^VALM1
DO TITLE^BIUTL5("Select Entire File of "_BIITEMS)
+9 WRITE !!!?8,"NOTE: This file is too large to load for screen selection."
+10 WRITE !?14,"Instead, the entire file (ALL Items) have been selected"
+11 WRITE !?14,"automatically.",!!
+12 DO DIRZ^BIUTL3()
+13 KILL @(BIARR1)
+14 SET @(BIARR1_"(""ALL"")")=""
+15 SET VALMBCK="Q"
+16 SET VALMQUIT=""
+17 QUIT
+18 ;
+19 ;
+20 ;----------
DELITEM ;EP
+1 ;---> Delete an Item from the Selection Array via List Manager.
+2 ;---> Steps:
+3 ; 1) This entry point is called by the Protocol:
+4 ; BI GEN SELECT DELETE, an action on the List Manager
+5 ; menu protocol: BI MENU GEN SELECT.
+6 ;
+7 ; 2) This code gets an Item from Listmanager and
+8 ; deletes the Item from the Selection Array and the
+9 ; ^TMP global.
+10 ;
+11 IF $$CHECK^BISELECT()
QUIT
+12 ;
+13 ;---> Call the Listmanager Generic Selector of Items displayed.
+14 NEW VALMY
+15 DO EN^VALM2(XQORNOD(0),"OS")
+16 ;
+17 ;---> Check that a Listman Item was passed.
+18 IF '$DATA(VALMY)
DO ERRCD^BIUTL2(406,,1)
DO RESET^BISELEC1
QUIT
+19 NEW Y
SET Y=$ORDER(VALMY(0))
+20 IF '$GET(Y)
DO ERRCD^BIUTL2(406,,1)
DO RESET^BISELEC1
QUIT
+21 ;
+22 ;---> Now set Y=IEN of the Item to delete in the BIARR1 local array.
+23 SET Y=$PIECE($GET(^TMP("BILMGS2",$JOB,Y)),U)
+24 IF Y=""
DO ERRCD^BIUTL2(604,,1)
DO RESET^BISELEC1
QUIT
+25 ;
+26 ;---> If ALL/ENTIRE was previously selected, it is no longer valid,
+27 ;---> so kill it.
+28 KILL @(BIARR1_"(""ALL"")")
+29 ;---> Delete the Item from the Selection Array.
+30 KILL @(BIARR1_"(Y)")
+31 SET BIPOP=""
+32 ;
+33 DO RESET^BISELEC1
+34 QUIT
+35 ;
+36 ;
+37 ;----------
CLEARALL ;EP
+1 ;---> Clear/Delete ALL Items from the Selection Array.
+2 ;---> Steps:
+3 ; 1) This entry point is called by the Protocol:
+4 ; BI GEN SELECT CLEAR ALL, an action on the List Manager
+5 ; menu protocol: BI MENU GEN SELECT.
+6 ;
+7 ; 2) This code deletes ALL Items from Listmanager and
+8 ; from the Selection Array and ^TMP global.
+9 ;
+10 IF $$CHECK^BISELECT()
QUIT
+11 ;
+12 ;---> Delete the Item from the Selection Array.
+13 KILL @(BIARR1)
+14 KILL ^TMP("BILMGS",$JOB),^TMP("BILMGS1",$JOB),^TMP("BILMGS2",$JOB)
+15 ;
+16 DO RESET^BISELEC1
+17 QUIT