source: FOIAVistA/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DDXP4.m@ 899

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

initial load of FOIAVistA 6/30/08 version

File size: 5.6 KB
Line 
1DDXP4 ;SFISC/DPC,S0-EXPORT DATA ;7:37 AM 30 May 2000
2 ;;22.0;VA FileMan;**9,38**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4EN1 ;
5 K ^UTILITY($J)
6 D ^DICRW I Y=-1 G QUIT
7 S DDXPFINO=+Y
8XTEM ;
9 S DIC="^DIPT(",DIC(0)="QEASZ",DIC("A")="Choose an EXPORT template or '^' to Quit: ",DIC("S")="I $P(^(0),U,8)=3",D="F"_DDXPFINO W !
10 D IX^DIC K DIC,D I $D(DTOUT)!$D(DUOUT) G QUIT
11 I Y=-1 G XTEM
12 S DDXPXTNO=+Y,DDXPXTNM=$P(Y,U,2),FLDS="["_DDXPXTNM_"]"
13 I DUZ(0)[$E($P(Y(0),U,6),1)!(DUZ(0)="@") D I $D(DIRUT) G QUIT
14 . W !,"Do you want to delete the "_DDXPXTNM_" template",!,"after the data export is complete?",!
15 . S DDXPTMDL=0,DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR W !
16 . S:Y DDXPTMDL=1
17 S DDXPFFNO=+$G(^DIPT(DDXPXTNO,105)),DDXPFMZO=$G(^DIST(.44,DDXPFFNO,0))
18 I $G(^DIST(.44,DDXPFFNO,6))]"" S DDXPDATE=1
19 S DDXPATH=$P($G(^DIPT(DDXPXTNO,105)),U,4) I DDXPATH]"" D MULTBY
20SORS ;
21 W ! S DIR(0)="YA",DIR("B")="NO",DIR("A")="Do you want to SEARCH for entries to be exported? "
22 S DIR("?",1)="To use VA FileMan's SEARCH option to choose entries, answer 'YES'."
23 S:'$D(BY) DIR("?",2)="After the SEARCH, you can respond to VA FileMan's 'SORT BY:' prompt."
24 S DIR("?")="If you answer 'NO', "_$S('$D(BY):"you can only SORT entries before export.",1:"the data export will begin.")
25 D ^DIR K DIR I $D(DIRUT) G QUIT
26 S DDXPSORS=Y,DIC=DDXPFINO,L=0
27 D DIOBEG,DIOEND
28 I DDXPSORS D EN^DIS
29 I $G(X)="^"!($G(POP)) G QUIT
30 I 'DDXPSORS D EN1^DIP
31 I $G(X)="^"!($G(POP)) G QUIT
32 I $G(DDXPQ),$G(DDXPTMDL) W !,?5,"Export template "_DDXPXTNM_" will be deleted",!,?5,"when queued export is completed." G DONE
33 I $G(DDXPTMDL) S DIK="^DIPT(",DA=DDXPXTNO D ^DIK K DIK,DA
34 G DONE
35QUIT ;
36 W !!,?10,"Export NOT completed!"
37DONE ;
38 K DDXPFINO,DDXPSORS,DDXPIOM,DDXPIOSL,DDXPXTNO,DDXPXTNM,DDXPFFNO,DDXPFMZO,DDXPCUSR,DDXPDATE,DDXPTMDL,DDXPY,DDXPATH,L,Y,DTOUT,DUOUT,DIRUT,DIC,FLDS,BY,FR,DIOEND,DIOBEG,DDXPQ,X,POP
39 Q
40ZIS ;
41 S %ZIS="Q"
42 S DDXPIOM=$S($P(DDXPFMZO,U,8):$P(DDXPFMZO,U,8),$G(^DIPT(DDXPXTNO,"IOM")):^("IOM"),1:80)
43 S DDXPIOSL=99999
44 Q
45MULTBY ;
46 N NUMPC,I,C S BY="",C=",",NUMPC=$L(DDXPATH,C)
47 W !!,"Since you are exporting fields from multiples,"
48 W !,"a sort will be done automatically."
49 W !,"You will NOT have the opportunity to sort the data before export.",!
50 F I=1:1:NUMPC D
51 . S BY=BY_DDXPATH_",NUMBER,"
52 . S DDXPATH=$P(DDXPATH,C,1,$L(DDXPATH,C)-1)
53 . Q
54 S BY=$E(BY,1,$L(BY)-1),FR=""
55 Q
56DIOBEG ;
57 S DDXPBEG=$G(^DIST(.44,DDXPFFNO,1))
58 I DDXPBEG']"" G QBEG
59 I $E(DDXPBEG)="""" S DIOBEG="W "_DDXPBEG G QBEG
60 S DIOBEG=DDXPBEG
61QBEG K DDXPBEG
62 Q
63DIOEND ;
64 S DDXPEND=$G(^DIST(.44,DDXPFFNO,2))
65 I DDXPEND']"" G QEND
66 I $E(DDXPEND)="""" S DIOEND="W "_DDXPEND G QEND
67 S DIOEND=DDXPEND
68QEND K DDXPEND
69 Q
70DJTOPY(Y) ;
71 N BJ,EJ,YOUT,NUMW,TYPEJ,DDXPXORY,SUB S YOUT=Y
72 S BJ=$F(Y,"$J(") I BJ D
73 . S DDXPXORY=$P($E(Y,BJ,999),",",1)
74 . S NUMW=$L($E(Y,1,BJ),"W")-1 I NUMW'>0 Q
75 . S EJ=$F(Y,") ",BJ)
76 . S TYPEJ=$L($E(Y,BJ,$S(EJ:EJ-1,1:999)),",")
77 . I TYPEJ'=2&(TYPEJ'=3) Q
78 . I TYPEJ=3 S SUB="$S("_DDXPXORY_"]"""":+"_DDXPXORY_",1:"""_$P(DDXPFMZO,U,13)_""")"
79 . I TYPEJ=2 S SUB=DDXPXORY
80 . S YOUT=$P($E(Y,1,BJ),"W",1,NUMW)_"W "_SUB_$S(EJ:$E(Y,EJ-1,999),1:"")
81 . Q
82 Q YOUT
83DT ;
84 N X
85 I 'Y S DDXPY=Y Q
86 S X=Y
87 I $D(^DIST(.44,DDXPFFNO,6)) X ^(6) S DDXPY=$G(Y)
88 Q
89EN2 ; Export API from EXPORT^DDXP
90 N DDXP,DDXPXTNO,DDPXFFNO,DDXPFMZO,DDXPDATE,DDXPATH,DDXPOUT,ERROR,DIA
91 K ^UTILITY($J)
92 ; Check for valild file number
93 I '$G(DDXPFINO) S ERROR="File Number Missing." D EN2ERR G DONE
94 I DDXPFINO[U D I $D(DDXPOUT) K DDXPOUT G DONE
95 . I $P(DDXPFINO,U)'=1.1 S DDXPOUT=1,ERROR="You can only use the "","" syntax if doing an Export of the Audit File(1.1)" D EN2ERR Q
96 . I '$D(^DIC(+$P(DDXPFINO,U,2),0))#2 S DDXPOUT=1,ERROR="File Does Not Exist on This System." D EN2ERR Q
97 I DDXPFINO'[U,'$D(^DIC(+DDXPFINO,0))#2 S ERROR="File Does Not Exist on This System." D EN2ERR G DONE
98 N DIC,D,X
99 S DIC="^DIPT(",DIC(0)="SZ",DIC("S")="I $P(^(0),U,8)=3",D="F"_+DDXPFINO,X=DDXPXTNM
100 D IX^DIC K DIC
101 I Y<0 S ERROR="The Template is Not an Export Template or Is Missing." D EN2ERR G DONE
102 S DDXPXTNO=+Y
103 S DDXPFFNO=+$G(^DIPT(DDXPXTNO,105)),DDXPFMZO=$G(^DIST(.44,DDXPFFNO,0))
104 I $G(^DIST(.44,DDXPFFNO,6))]"" S DDXPDATE=1
105 I $G(DDXPBY)="" S DDXPATH=$P($G(^DIPT(DDXPXTNO,105)),U,4) I DDXPATH]"" D MULTBY
106 ; Setup For Sort Template If BY NOT Setup by MULTBY
107 I '$D(BY) D I $D(DDXPOUT) K DDXPOUT S ERROR="Sort Template Invalid or Missing." D EN2ERR G DONE
108 . I $G(DDXPBY)]"" D Q:$D(DDXPOUT)
109 .. N DIC,X
110 .. S DIC="^DIBT(",DIC(0)="Z",X=DDXPBY
111 .. D ^DIC K DIC
112 .. I Y<0 S DDXPOUT=1 Q
113 .. D SORTCHK I $D(DDXPOUT) Q
114 .. S BY="["_DDXPBY_"]"
115 S DDXP=4 ; Tell other FileMan routines we are Exporting
116 S DIC=$S(+DDXPFINO=1.1:"^DIA("_+$P(DDXPFINO,U,2)_",",1:+DDXPFINO)
117 S L=0
118 S FLDS="["_DDXPXTNM_"]"
119 D DIOBEG,DIOEND,EN1^DIP
120 I $G(X)="^"!($G(POP)) K DDXP,DDXPBY,DDXPFR,DDXPTO G QUIT
121 K:$D(DIA) DIA ; **Leaking Variable**
122 I $G(DDXPTMDL) S DIK="^DIPT(",DA=DDXPXTNO D ^DIK K DIK,DA
123 K DDXP,DDXPBY,DDXPFR,DDXPTO
124 G DONE
125SORTCHK ; Check Sort For Illegal Qualifiers
126 N D0,D1,DDXPX,I
127 S D0=+Y
128 S D1=0
129 F S D1=$O(^DIBT(D0,2,D1)) Q:D1<1!$D(DDXPOUT) D
130 . S DDXPX=^DIBT(D0,2,D1,0)
131 . F I="#","!","+","@" D Q:$D(DDXPOUT)
132 .. I $P(DDXPX,U,4)[I,I'="@" S DDXPOUT=1,ERROR="You can not use the """_I_""" when exporting." D EN2ERR Q
133 .. I I="@",$P(DDXPX,U,4)["@",$P(DDXPX,U,4)'["@B" S DDXPOUT=1,ERROR="You can not use the ""@"" when exporting." D EN2ERR Q
134 . F I=";C",";S" D Q:$D(DDXPOUT)
135 .. I $P(DDXPX,U,5)[I S DDXPOUT=1,ERROR="You can not use "_I_" when exporting." D EN2ERR Q
136 .. I $P(DDXPX,U,5)[";""" S DDXPOUT=1,ERROR="You can Replace a Caption when exporting." D EN2ERR Q
137 Q
138EN2ERR ; Error Processing
139 I $D(IOST),$E(IOST,1,2)="C-" W $C(7)
140 W "=>"_ERROR,!
141 K DDXPBY,DDXPFR,DDXPTO,ERROR
142 Q
Note: See TracBrowser for help on using the repository browser.