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

WVSELECT.m

Go to the documentation of this file.
WVSELECT ;HCIOFO/FT,JR IHS/ANMC/MWR - SELECT ENTRIES FROM A WVFILE ;
 ;;1.0;WOMEN'S HEALTH;;Sep 30, 1998
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  UTILITY TO PROMPT FOR MULTIPLE SELECTIONS FROM A FILE AND STORE
 ;;  THEM IN A LOCAL ARRAY FOR SOWV BY CALLING PROGRAM.
 ;
HOSP ;---> EXAMPLE: SELECT HOSPITAL LOCATIONS.
 D SETVARS^WVUTL5
 ;---> 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 "WVARR1" OR IT WILL KILL THE VARIBLE,
 ;--->           WVARR1, THAT STORES THE LOCAL ARRAY NAME!
 ;---> 4TH PARAMETER=SCREEN USED IN SELECTION LOOKUP.
 ;---> 5TH PARAMETER=DEFAULT FIRST SELECTION.
 ;---> 6TH PARAMETER=WVPOP=1 IF QUIT OR ERROR.
 ;---> SCREEN WOULD BE 4TH PARAMETER.
 ;S WVSCRN="I $D(^SC(,""ARC"",""S"",Y))"
 D SELECT("clinic/ward",44,"WVLOC","","",.WVPOP)
 Q
 ;
SELECT(WVITEM,WVFILE,WVARR1,WVSCRN,WVDFLT,WVPOP) ;EP
 N DIC,DIR,WVGBL,WVITEMS,Y
 I '$D(WVITEM)!('$G(WVFILE))!('$D(WVARR1)) S WVPOP=1 Q
SELECT1 ;
 K @WVARR1
 S WVGBL=^DIC(WVFILE,0,"GL")
 ;---> IF .01 FIELD IS A POINTER, RESET GLOBAL TO GET TEXT FROM
 ;---> POINTED TO GLOBAL.
 I $E($P(^DD(WVFILE,.01,0),U,2),2)="P" S WVGBL="^"_$P(^(0),U,3)
 D PLURAL
 W ! S DIR("A")="   Include ALL "_WVITEMS_" in this listing"
 S DIR(0)="Y",DIR("B")="Y"
 S DIR("?",1)="     Answer ""YES"" to include ALL "_WVITEMS_";"
 S DIR("?")="     Answer ""NO"" to select one or more "_WVITEMS_"."
 D ^DIR K DIR
 I $D(DIRUT) S WVPOP=1 Q
 ;---> IF ALL ARE SELECTED, QUIT HERE.
 I Y S @(WVARR1_"(""ALL"")")="",WVPOP=0 W ! Q
 ;
 W !!?3,"Select the "_WVITEM_"(s) you wish to include in this listing."
 S DIC(0)="QEMA",DIC=WVFILE
 S DIC("A")="   Select "_WVITEM_": "
 S:$D(WVDFLT) DIC("B")=WVDFLT
 S:$D(WVSCRN) DIC("S")=WVSCRN
 F  D ^DIC K DIC("B") Q:Y<0  S @(WVARR1_"(+Y)")=""
 I '$D(@WVARR1) D  S WVPOP=1 Q
 .W !?3,"No ",WVITEM," selected.",! D DIRZ^WVUTL3
 W !!?3,"The following ",WVITEMS," will be included in this report:"
 W !?3,$$REPEAT^XLFSTR("-",48+$L(WVITEM))
 ;W !?3 F I=1:1:48+$L(WVITEM) W "-"
 S N=0 F  S N=$O(@(WVARR1_"(N)")) Q:'N  D
 .W !?5,$P(@(WVGBL_"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(@(WVGBL_"N,0)"),U,2)
 W ! S DIR(0)="Y",DIR("A")="   Is this correct",DIR("B")="Y"
 D ^DIR I $D(DIRUT) S WVPOP=1 Q
 I 'Y K @WVARR1 D  G SELECT1
 .W "   All ",WVITEMS," deleted.",!?26," * Please begin again. *"
 S WVPOP=0 W !
 Q
 ;
PLURAL ;EP
 ;---> CHANGE Y TO I AND AS ES IF NECESSARY.
 I "Yy"[$E(WVITEM,$L(WVITEM)) D  Q
 .S WVITEMS=$E(WVITEM,1,($L(WVITEM)-1))_"ies"
 S WVITEMS=WVITEM_"s"
 Q