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

BWSELECT.m

Go to the documentation of this file.
BWSELECT ;IHS/ANMC/MWR - SELECT ENTRIES FROM A BWFILE ;15-Feb-2003 22:11;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  UTILITY TO PROMPT FOR MULTIPLE SELECTIONS FROM A FILE AND STORE
 ;;  THEM IN A LOCAL ARRAY FOR SOBW BY CALLING PROGRAM.
 ;
HOSP ;---> EXAMPLE: SELECT HOSPITAL LOCATIONS.
 D SETVARS^BWUTL5
 ;---> 1ST PARAMETER=CATAGORIC NAME OF ITEMS BEING SELECTED.
 ;---> 2ND PARAMETER=FILE NUMBER FROM WHICH SELECTION IS MADE.
 ;---> 3RD PARAMETER=LOCAL ARRAY IN WHICH SELECTIONS WILL BE STORED.
 ;--->     NOTE: THIS CANNOT BE "BWARR1" OR IT WILL KILL THE VARIBLE,
 ;--->           BWARR1, THAT STORES THE LOCAL ARRAY NAME!
 ;---> 4TH PARAMETER=SCREEN USED IN SELECTION LOOKUP.
 ;---> 5TH PARAMETER=DEFAULT FIRST SELECTION.
 ;---> 6TH PARAMETER=BWPOP=1 IF QUIT OR ERROR.
 ;---> SCREEN WOULD BE 4TH PARAMETER.
 ;S BWSCRN="I $D(^SC(,""ARC"",""S"",Y))"
 D SELECT("clinic/ward",44,"BWLOC","","",.BWPOP)
 Q
 ;
SELECT(BWITEM,BWFILE,BWARR1,BWSCRN,BWDFLT,BWPOP) ;EP
 N DIC,DIR,BWGBL,BWITEMS,Y
 I '$D(BWITEM)!('$G(BWFILE))!('$D(BWARR1)) S BWPOP=1 Q
SELECT1 ;
 K @BWARR1
 S BWGBL=^DIC(BWFILE,0,"GL")
 ;---> IF .01 FIELD IS A POINTER, RESET GLOBAL TO GET TEXT FROM
 ;---> POINTED TO GLOBAL.
 I $E($P(^DD(BWFILE,.01,0),U,2),2)="P" S BWGBL="^"_$P(^(0),U,3)
 D PLURAL
 W ! S DIR("A")="   Include ALL "_BWITEMS_" in this listing"
 S DIR(0)="Y",DIR("B")="Y"
 S DIR("?",1)="     Answer ""YES"" to include ALL "_BWITEMS_";"
 S DIR("?")="     Answer ""NO"" to select one or more "_BWITEMS_"."
 D ^DIR K DIR
 I $D(DIRUT) S BWPOP=1 Q
 ;---> IF ALL ARE SELECTED, QUIT HERE.
 I Y S @(BWARR1_"(""ALL"")")="",BWPOP=0 W ! Q
 ;
 W !!?3,"Select the "_BWITEM_"(s) you wish to include in this listing."
 S DIC(0)="QEMA",DIC=BWFILE
 S DIC("A")="   Select "_BWITEM_": "
 S:$D(BWDFLT) DIC("B")=BWDFLT
 S:$D(BWSCRN) DIC("S")=BWSCRN
 F  D ^DIC K DIC("B") Q:Y<0  S @(BWARR1_"(+Y)")=""
 I '$D(@BWARR1) D  S BWPOP=1 Q
 .W !?3,"No ",BWITEM," selected.",! D DIRZ^BWUTL3
 W !!?3,"The following ",BWITEMS," will be included in this report:"
 W !?3 F I=1:1:48+$L(BWITEM) W "-"
 S N=0 F  S N=$O(@(BWARR1_"(N)")) Q:'N  D
 .W !?5,$P(@(BWGBL_"N,0)"),U)
 .;---> NEXT LINE WOULD BE CODE TO BUILD FOR DISPLAYING AN ADDITIONAL
 .;---> PIECE OF THE ZERO NODE OF THE SELECTED ENTRIES (IDENTIFIERS).
 .;W " - ",$P(@(BWGBL_"N,0)"),U,2)
 W ! S DIR(0)="Y",DIR("A")="   Is this correct",DIR("B")="Y"
 D ^DIR I $D(DIRUT) S BWPOP=1 Q
 I 'Y K @BWARR1 D  G SELECT1
 .W "   All ",BWITEMS," deleted.",!?26," * Please begin again. *"
 S BWPOP=0 W !
 Q
 ;
PLURAL ;EP
 ;---> CHANGE Y TO I AND AS ES IF NECESSARY.
 I "Yy"[$E(BWITEM,$L(BWITEM)) D  Q
 .S BWITEMS=$E(BWITEM,1,($L(BWITEM)-1))_"ies"
 S BWITEMS=BWITEM_"s"
 Q