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

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1DIQGDD ;SFISC/DCL-DATA DICTIONARY ATTRIBUTE RETRIEVER ;10:55 AM 8 Nov 2000
2 ;;22.0;VA FileMan;**65**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4GET(DIQGR,DA,DR,DIQGPARM,DIQGETA,DIQGERRA,DIQGIPAR) ;
5EN3 I $G(U)'="^" N U S U="^"
6 I $G(DIQGIPAR)'["A" K DIERR,^TMP("DIERR",$J)
7 I $G(DIQGR)'>0 N X S X(1)="FILE" Q $$F^DIQG(.X,1)
8 I $G(DA)']"" S DA=DIQGR,DIQGR=1 I '$D(^DIC(DA,0)) S X(1)="FILE" Q $$F^DIQG(.X,1)
9 S:DIQGR>1 DIQGPARM=$G(DIQGPARM)_"D"
10 I DA'?.N,$D(^DD(DIQGR,"B",DA)) S DA=$O(^(DA,"")) I $O(^(DA)) D 200 Q ""
11 I DA'>0 D 200 Q ""
12 I DR="FIELD LENGTH" Q $$FL^DIQGDDU(DIQGR,DA)
13 I DR="REQUIRED IDENTIFIERS" G RI^DIQGDDU
14 N DRSV S DRSV=DR N DR
15 S DR=$$ATRBT(DIQGR=1,$G(DRSV)) I 'DR D 202("ATTRIBUTE") Q ""
16 G DDENTRY^DIQG
17 ;
18FIELD(DIQGR,DA,DR,DIQGPARM,DIQGTA,DIQGERRA,DIQGIPAR) ;
19EN1 N DIQGERR,DIQGEY,DIQGSAL,DIQGFNUL,DIQGSALX,DIQGTAXX
20 S DIQGEY(1)=$G(DIQGR)
21 I $G(U)'="^" N U S U="^"
22 I $G(DIQGIPAR)'["A" K DIERR,^TMP("DIERR",$J)
23 I $G(DIQGR)'>0 D 202("FILE") Q
24 I $G(DA)']"" D 202("FIELD") Q
25 I $D(^DD(DIQGR,0))[0 D 202("FILE") Q
26 I $G(DIQGTA)']"" D 202("TARGET ARRAY") Q
27 S DIQGPARM=$G(DIQGPARM)_"D",DIQGFNUL=DIQGPARM["N"
28 I DA'?.N,$D(^DD(DIQGR,"B",DA)) S DA=$O(^(DA,"")) I $O(^(DA)) N X S X(1)=DA,X("FILE")=DIQGR D BLD^DIALOG(505,.X),FE Q
29 I DA'>0 S DIQGEY(3)=DA D 200 Q
30 I $D(^DD(DIQGR,DA,0))[0 S DIQGEY(3)=DA D 200 Q
31 D BLDSAL(0,.DR,.DIQGSAL)
32 I '$D(DIQGSAL),'$D(DIERR) D 200 Q
33 I '$D(DIQGSAL) Q
34 S DIQGSAL="" F S DIQGSAL=$O(DIQGSAL(DIQGSAL)) Q:DIQGSAL="" D
35 .S DIQGTAXX=$S('$D(DIQGSAL(DIQGSAL,"#(word-processing)")):DIQGTA,1:$$OREF(DIQGTA)_$$Q(DIQGSAL)_")")
36 .I DIQGSAL="FIELD LENGTH" S DIQGSALX=$$FL^DIQGDDU(DIQGR,DA) G SET
37 .S DIQGSALX=$$GET^DIQG("^DD("_DIQGR_",",DA,DIQGSAL(DIQGSAL),DIQGPARM,DIQGTAXX,"","1A")
38SET .I DIQGSALX]"" S @DIQGTA@(DIQGSAL)=DIQGSALX Q
39 .Q:DIQGFNUL
40 .S @DIQGTA@(DIQGSAL)=DIQGSALX
41 .Q
42 Q
43 ;
44BLDSAL(DIQGTYPE,DIQGDR,DIQGVALA) ;DIQGTYPE=1 for FILE and 0 for FIELD, DIQGDR=string/array, DIQGVALA=valid attribute list array
45 ; * If DIQGDR is an array pass by reference *
46 I $G(DIQGDR)="*" D LIST^DIQGDDT($S(DIQGTYPE=1:"FILETXT",1:"FIELDTXT"),.DIQGVALA,"",3) Q
47 N DIQGER,DIQGI,DIQGX,DIQGY D LIST^DIQGDDT($S(DIQGTYPE=1:"FILETXT",1:"FIELDTXT"),.DIQGX,"",3)
48 I $G(DIQGDR)]"" F DIQGI=1:1 S DIQGY=$P(DIQGDR,";",DIQGI) Q:DIQGY="" D
49 .I '$D(DIQGX(DIQGY)) S DIQGER(4)=DIQGY D 200 Q
50 .S DIQGVALA(DIQGY)=DIQGX(DIQGY) S:$D(DIQGX(DIQGY,"#(word-processing)")) DIQGVALA(DIQGY,"#(word-processing)")=DIQGX(DIQGY)
51 Q:$D(DIQGVALA)
52 S DIQGY="" F S DIQGY=$O(DIQGDR(DIQGY)) Q:DIQGY="" D
53 .I '$D(DIQGX(DIQGY)) S DIQGER(4)=DIQGY D 200 Q
54 .S DIQGVALA(DIQGY)=DIQGX(DIQGY) S:$D(DIQGX(DIQGY,"#(word-processing)")) DIQGVALA(DIQGY,"#(word-processing)")=DIQGX(DIQGY)
55 .Q
56 Q
57 ;
58XDR(DIQGR,DR,DIQGERR) ;DIQGR DD FILE NUMBER EITHER 1 OR 0
59 ;DR IS DR STRING TO CONVERT TO NUMERIC DR STRING
60 S DIQGR=+$G(DIQGR),DR=$G(DR)
61 N I,X,XDR D LIST^DIQGDDT($S(DIQGR=1:"FILETXT",1:"FIELDTXT"),.X,4,3)
62 I $G(DR)]"" S (X,XDR)="" F I=1:1 S X=$P(DR,";",I) Q:X="" D
63 .I '$D(X(X)) S DIQGERR(X)="" Q
64 .S XDR=XDR_X(X)_";" Q
65 I $D(DR)>1 S (X,XDR)="" F S X=$O(DR(X)) Q:X="" D:'$D(X(X)) S:X]"" XDR=XDR_X(X)_";"
66 .I '$D(X(X)) S DIQGERR(X)="" Q
67 .S XDR=XDR_X(X)_";" Q
68 Q XDR
69 ;
70ATRBT(TYPE,ATRIB) ;EXTRINSIC FUNCTION $$TEST IF VALID ATTRIBUTE
71 ;TYPE 0 OR 1 - FIELD=0, FILE=1 (^DD(0) OR ^DD(1))
72 ;ATRIB=ATTRIBUTE BEING REQUESTED
73 Q:ATRIB']"" 0
74 N X D LIST^DIQGDDT($S(TYPE=1:"FILETXT",1:"FIELDTXT"),.X,,3)
75 Q $G(X(ATRIB))
76DR(TYPE) ;TYPE=1,FILE OR 0,FIELD AND RETURNS DR STRING FOR ALL ATTRIBUTES IN INTERNAL FORM (ATTRIBUTE FIELD NUMBERS 3RD ;-PIECE
77 S TYPE=+$G(TYPE)
78 N X,Y
79 D LIST^DIQGDDT($S(TYPE=1:"FILETXT",1:"FIELDTXT"),.X,3)
80 S (X,Y)=.01 F S Y=$O(X(Y)) Q:Y'>0 S X=X_";"_Y
81 Q X
82 ;
83FILELST(DIDARRAY) ;PASS TARGET ARRAY BY REFERENCE * * LIST FILE ATTRIBUTES * *
84EN4 N EQL,TP,TYPE,DIQGDFLG
85 S TYPE="FILETXT",DIQGDFLG="L"
86 G ENLST^DIQGDDT
87 ;
88FIELDLST(DIDARRAY) ;PASS TARGET ARRAY BY REFERENCE * * LIST FIELD ATTRIBUTES * *
89EN5 N EQL,TP,TYPE,DIQGDFLG
90 S TYPE="FIELDTXT",DIQGDFLG="L"
91 G ENLST^DIQGDDT
92 ;
93OREF(X) N X1,X2 S X1=$P(X,"(")_"(",X2=$$OR2($P(X,"(",2)) Q:X2="" X1 Q X1_X2_","
94OR2(%) Q:%=")"!(%=",") "" Q:$L(%)=1 % S:"),"[$E(%,$L(%)) %=$E(%,1,$L(%)-1) Q %
95Q(%Z) S %Z(%Z)="",%Z=$Q(%Z("")) Q $E(%Z,4,$L(%Z)-1)
96200 D BLD^DIALOG(200),FE Q
97202(E) N X S X(1)=E
98 D BLD^DIALOG(202,.X),FE
99 Q
100FE I $G(DIQGERRA)]"" D CALLOUT^DIEFU(DIQGERRA)
101 Q
Note: See TracBrowser for help on using the repository browser.