source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DICF1.m@ 1046

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

initial load of WorldVistAEHR

File size: 4.7 KB
RevLine 
[613]1DICF1 ;SEA/TOAD,SF/TKW-VA FileMan: Finder, Part 2 (Transform) ;1:36 PM 6 May 2004
2 ;;22.0;VA FileMan;**15,51,70,135**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5XFORM(DIFLAGS,DIVALUE,DISCREEN,DINDEX) ;
6 ; FIND--produce array of values and screens by transforming input
7 ; subroutine, DIVALUE, DINDEX, & DISCREEN passed by reference
8 N DISUB F DISUB=1:1:DINDEX("#") D VALUES
9 Q
10VALUES ; Set original lookup value into array.
11 I $D(DIVALUE(DISUB,0,1)) S DIVALUE(DISUB)=DIVALUE(DISUB,0,1)
12 N I F I="PART","FROM","TO" I $D(DIVALUE(DISUB,0,1,I)) D
13 . S DINDEX(DISUB,I)=DIVALUE(DISUB,0,1,I) Q
14 D
15 . S I=-1 F S I=$O(DIVALUE(DISUB,I)) Q:I="" K DIVALUE(DISUB,I)
16 . S I=-1 F S I=$O(DISCREEN(DISUB,I)) Q:I="" K DISCREEN(DISUB,I)
17 . Q
18 S DIVALUE(DISUB,1)=DIVALUE(DISUB)
19 Q:DIVALUE(DISUB)=""
20 I DIFLAGS["Q" D LONG Q
21LOWER ;
22 I DIVALUE(DISUB)?.E1L.E,DIFLAGS'["X" D
23 . S DIVALUE(DISUB,2)=$$OUT^DIALOGU(DIVALUE(DISUB),"UC")
24 . Q
25 ;
26CHK ; Quit if data type not free-text, pointer or vp, or if lookup value is numeric or a date.
27 I "PVF"'[$G(DINDEX(DISUB,"TYPE"))!(DIVALUE(DISUB)?.NP) Q
28 N Y D Q:Y>0
29 . N X S X=DIVALUE(DISUB) N %DT,DIFLAGS,DIVALUE,DISCREEN,DINDEX,DISUB
30 . S %DT="T" D ^%DT Q
31COMMA I DIVALUE(DISUB)[",",DIFLAGS'["X" D
32 . N DISTEMP,DIPIECE1 S DISTEMP="",DIPIECE1=$P(DIVALUE(DISUB),",")
33 . Q:$L(DIPIECE1)>DINDEX(DISUB,"LENGTH")
34 . Q:'$L(DIPIECE1) ;SO
3521 . I DIFLAGS["C" D
36 . . N DIPART1 S DIPART1=" I %?.E1P1"""
37 . . N DIPART2 S DIPART2=""".E!(D'=""B""&(%?1"""
38 . . N DIPART3 S DIPART3=""".E))"
39 . . N DIOUT S DIOUT=0
40 . . N DIPIECE,DIVPIECE F DIPIECE=2:1 D I DIOUT Q
41 . . . S DIVPIECE=$P(DIVALUE(DISUB),",",DIPIECE)
42 . . . I DIVPIECE["""" Q
43 . . . I $E(DIVPIECE)=" " S DIVPIECE=$E(DIVPIECE,2,$L(DIVPIECE))
44 . . . I DIVPIECE="" S DIOUT=1 Q
45 . . . I $L(DIVPIECE)*2+$L(DISTEMP)+33+14+34>255 S DIOUT=1 Q
46 . . . S DISTEMP=DISTEMP_DIPART1_DIVPIECE_DIPART2_DIVPIECE_DIPART3
47 . . . Q:DISTEMP=""
48 . . . S DISTEMP="S %=DIVAL "_DISTEMP Q ;22*135
49 . . I DISTEMP="" Q
5022 . I DIFLAGS'["C" N DIPIECE2,DIPC2 D
51 . . S (DIPC2,DIPIECE2)=$P(DIVALUE(DISUB),",",2)
52 . . I DIPIECE2["""" S DIPC2=$$CONVQQ^DILIBF(DIPIECE2)
53 . . S DISTEMP="S %=$P(DIVAL,"","",2) I $E(%,1,"_$L(DIPIECE2)_")="""_DIPC2_""""
54 . . Q
5523 . S DIVALUE(DISUB,3)=DIPIECE1
56 . S DISCREEN(DISUB,3)=DISTEMP
57 . I DIFLAGS'["C" S DIVALUE(DISUB,3,"c")=DIPIECE2
5824 . I DIVALUE(DISUB)'?.E1L.E Q
59 . S DIVALUE(DISUB,4)=$$OUT^DIALOGU(DIPIECE1,"UC")
60 . S DISCREEN(DISUB,4)=$$OUT^DIALOGU(DISTEMP,"UC")
61 . I DIFLAGS'["C" S DIVALUE(DISUB,4,"c")=$$OUT^DIALOGU(DIPIECE2,"UC")
62 ;
63LONG I $L(DIVALUE(DISUB))'>DINDEX(DISUB,"LENGTH") Q
64 N J,X,DISLONG,DISPART,DISXACT,DIREF
65 F I=0:0 S I=$O(DIVALUE(DISUB,I)) Q:'I D
66 . N L,M S L=DINDEX(DISUB,"LENGTH")
67 . Q:$L(DIVALUE(DISUB,I))'>L
68 . S X=DIVALUE(DISUB,I) K DIVALUE(DISUB,I) S DIVALUE(DISUB,0,I)=X
69 . I $G(DISCREEN(DISUB,I))]"" S X=DISCREEN(DISUB,I) K DISCREEN(DISUB,I) S DISCREEN(DISUB,0,I)=X
70 . S DIVALUE(DISUB,I)=$E(DIVALUE(DISUB,0,I),1,L)
71 . I I=1 D
72 . . S (DIVALUE(DISUB),DINDEX(DISUB))=DIVALUE(DISUB,I)
73 . . F J="PART","FROM","TO" S M=$L($G(DINDEX(DISUB,J))) D:M>L
74 . . . S DIVALUE(DISUB,0,I,J)=DINDEX(DISUB,J)
75 . . . S DINDEX(DISUB,J)=$E(DINDEX(DISUB,J),1,L) Q
76 . . Q
77 . S DISLONG=""
78 . I $D(DISCREEN(DISUB,0,I)) S DISLONG=" X DISCREEN("_DISUB_",0,"_I_")"
79 . S DIREF="DINDEX("_DISUB_",0,"_I_")"
80 . S DISPART="I $P(DIVAL,$G("_DIREF_"))="""""_DISLONG ;DI*22*70
81 . S DISXACT="I $P(DIVAL,U)="_DIREF_DISLONG
82L10 . I DIFLAGS["X" S DISCREEN(DISUB,I)=DISXACT Q
83 . I DIFLAGS'["O" S DISCREEN(DISUB,I)=DISPART Q
84 . S DISCREEN(DISUB,I)=DISXACT
85 . S DISCREEN(DISUB,I,2)=DISPART
86 . Q
87 Q
88 ;
89SPECIAL(DIFILE,DIEN,DIFIEN,DIFLAGS,DIVALUE,DINDEX,DISCREEN,DIDENT,DIOUT,DILIST) ;
90 ; Process space-bar return, 'IEN or DIVALUE equal to an IEN.
91 S DIOUT=0
9211 I DIVALUE=" " D S DIOUT=1 Q
93 . N DIROOT S DIROOT=$$ROOT^DIQGU(DIFILE,DIFIEN,"Q")
94 . N DINODE S DINODE=$G(^DISV(DUZ,$E(DIROOT,1,28)))
95 . N DINODEL S DINODEL=$L(DINODE,",")
96 . I $P(DINODE,",",1,DINODEL-1)'=$E(DIROOT,29,9999) Q
97 . S DIEN=$P(DINODE,",",DINODEL)
98 . I 'DIEN S DIEN="" Q
99 . D ENTRY Q
10012 I DIVALUE?1"`".NP D Q:DIOUT=1
101 . S DIEN=$E(DIVALUE,2,$L(DIVALUE)) Q:+DIEN'=DIEN
102 . D ENTRY S DIOUT=1 Q
10313 I $S(DIVALUE?1.N:1,DIVALUE'?.NP:0,1:+DIVALUE=DIVALUE) D
104 . N DI001 S DI001=$D(^DD(DIFILE,.001))
105 . N DI01FLAG S DI01FLAG=$P($G(^DD(DIFILE,.01,0)),U,2)
106 . I $D(@DIFILE(DIFILE)@(DIVALUE)) D
107 . . I DIFLAGS'["A",'DI001,DI01FLAG["N"!($O(@DIFILE(DIFILE)@("A["))'="") Q
108 . . S DIEN=DIVALUE
109 . . D ENTRY
110 . . I $G(DINDEX("DONE"))!($G(DIERR)) S DIEN="",DIOUT=1
111 Q
112 ;
113ENTRY ; Execute screens, and if entry passes, do ACCEPT to add it to output.
114 N DI0NODE S DI0NODE=$G(@DIFILE(DIFILE)@(DIEN,0))
115 Q:$$SCREEN^DICL2(.DIFILE,.DIEN,DIFLAGS,DIFIEN,.DISCREEN,.DINDEX,DI0NODE)
116 D ACCEPT^DICL2(.DIFILE,.DIEN,.DIFLAGS,DIFIEN,.DINDEX,.DIDENT,.DILIST,DI0NODE)
117 Q
Note: See TracBrowser for help on using the repository browser.