source: FOIAVistA/trunk/r/WOMENS_HEALTH-WV/WVSELECT.m@ 1245

Last change on this file since 1245 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1WVSELECT ;HCIOFO/FT,JR IHS/ANMC/MWR - SELECT ENTRIES FROM A WVFILE ;
2 ;;1.0;WOMEN'S HEALTH;;Sep 30, 1998
3 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
4 ;; UTILITY TO PROMPT FOR MULTIPLE SELECTIONS FROM A FILE AND STORE
5 ;; THEM IN A LOCAL ARRAY FOR SOWV BY CALLING PROGRAM.
6 ;
7HOSP ;---> EXAMPLE: SELECT HOSPITAL LOCATIONS.
8 D SETVARS^WVUTL5
9 ;---> 1ST PARAMETER=CATAGORIC NAME OF ITEMS BEING SELECTED.
10 ;---> 2ND PARAMETER=FILE NUMBER FROM WHICH SELECTION IS MADE.
11 ;---> 3RD PARAMETER=LOCAL ARRAY IN WHICH SELECTIONS WILL BE STORED.
12 ;---> NOTE: THIS CANNOT BE "WVARR1" OR IT WILL KILL THE VARIBLE,
13 ;---> WVARR1, THAT STORES THE LOCAL ARRAY NAME!
14 ;---> 4TH PARAMETER=SCREEN USED IN SELECTION LOOKUP.
15 ;---> 5TH PARAMETER=DEFAULT FIRST SELECTION.
16 ;---> 6TH PARAMETER=WVPOP=1 IF QUIT OR ERROR.
17 ;---> SCREEN WOULD BE 4TH PARAMETER.
18 ;S WVSCRN="I $D(^SC(,""ARC"",""S"",Y))"
19 D SELECT("clinic/ward",44,"WVLOC","","",.WVPOP)
20 Q
21 ;
22SELECT(WVITEM,WVFILE,WVARR1,WVSCRN,WVDFLT,WVPOP) ;EP
23 N DIC,DIR,WVGBL,WVITEMS,Y
24 I '$D(WVITEM)!('$G(WVFILE))!('$D(WVARR1)) S WVPOP=1 Q
25SELECT1 ;
26 K @WVARR1
27 S WVGBL=^DIC(WVFILE,0,"GL")
28 ;---> IF .01 FIELD IS A POINTER, RESET GLOBAL TO GET TEXT FROM
29 ;---> POINTED TO GLOBAL.
30 I $E($P(^DD(WVFILE,.01,0),U,2),2)="P" S WVGBL="^"_$P(^(0),U,3)
31 D PLURAL
32 W ! S DIR("A")=" Include ALL "_WVITEMS_" in this listing"
33 S DIR(0)="Y",DIR("B")="Y"
34 S DIR("?",1)=" Answer ""YES"" to include ALL "_WVITEMS_";"
35 S DIR("?")=" Answer ""NO"" to select one or more "_WVITEMS_"."
36 D ^DIR K DIR
37 I $D(DIRUT) S WVPOP=1 Q
38 ;---> IF ALL ARE SELECTED, QUIT HERE.
39 I Y S @(WVARR1_"(""ALL"")")="",WVPOP=0 W ! Q
40 ;
41 W !!?3,"Select the "_WVITEM_"(s) you wish to include in this listing."
42 S DIC(0)="QEMA",DIC=WVFILE
43 S DIC("A")=" Select "_WVITEM_": "
44 S:$D(WVDFLT) DIC("B")=WVDFLT
45 S:$D(WVSCRN) DIC("S")=WVSCRN
46 F D ^DIC K DIC("B") Q:Y<0 S @(WVARR1_"(+Y)")=""
47 I '$D(@WVARR1) D S WVPOP=1 Q
48 .W !?3,"No ",WVITEM," selected.",! D DIRZ^WVUTL3
49 W !!?3,"The following ",WVITEMS," will be included in this report:"
50 W !?3,$$REPEAT^XLFSTR("-",48+$L(WVITEM))
51 ;W !?3 F I=1:1:48+$L(WVITEM) W "-"
52 S N=0 F S N=$O(@(WVARR1_"(N)")) Q:'N D
53 .W !?5,$P(@(WVGBL_"N,0)"),U)
54 .;---> NEXT LINE WOULD BE CODE TO BUILD FOR DISPLAYING AN ADDITIONAL
55 .;---> PIECE OF THE ZERO NODE OF THE SELECTED ENTRIES (IDENTIFIERS).
56 .;W " - ",$P(@(WVGBL_"N,0)"),U,2)
57 W ! S DIR(0)="Y",DIR("A")=" Is this correct",DIR("B")="Y"
58 D ^DIR I $D(DIRUT) S WVPOP=1 Q
59 I 'Y K @WVARR1 D G SELECT1
60 .W " All ",WVITEMS," deleted.",!?26," * Please begin again. *"
61 S WVPOP=0 W !
62 Q
63 ;
64PLURAL ;EP
65 ;---> CHANGE Y TO I AND AS ES IF NECESSARY.
66 I "Yy"[$E(WVITEM,$L(WVITEM)) D Q
67 .S WVITEMS=$E(WVITEM,1,($L(WVITEM)-1))_"ies"
68 S WVITEMS=WVITEM_"s"
69 Q
Note: See TracBrowser for help on using the repository browser.