Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BISELEC2

BISELEC2.m

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