source: FOIAVistA/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XTIDTBL.m@ 1327

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

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1XTIDTBL ;OAKCIOFO/JLG - TABLE CONTEXT ;04/21/2005 15:12
2 ;;7.3;TOOLKIT;**93**;Apr 25, 1995
3 Q
4 ; Context implementation for "table"
5 ; CTX and TERM are passed by ref in all calls
6CONTEXT(TFILE,TFIELD,CTX) ; set up Context for "table" type
7 ; called from CONTEXT^XTIDCTX(TFILE,TFIELD,CTX)
8 ; returns a valid new CTX array
9 N SUBFILE
10 S TFILE=+$G(TFILE)
11 Q:'TFILE!($D(CTX))
12 ; determine the subfile for the multi-valued field
13 ; 99.991, EFFECTIVE DATE/TIME
14 S SUBFILE=$$GETSUBF(TFILE,99.991)
15 Q:'SUBFILE
16 S CTX("TYPE")="TABLE"
17 S CTX("TERM FILE#")=TFILE
18 S CTX("TERM FIELD#")=.01
19 S CTX("SOURCE FILE#")=TFILE
20 S CTX("TERMSTATUS SUBFILE#")=SUBFILE
21 Q
22 ;
23VALIDREF(CTX,TIREF) ; validate the term, internal ref
24 ; test TIREF is a valid value in given context (table)
25 ; TIREF must be in IENS form, but will be checked
26 ; later as VDUI related data is retrieved
27 ; would be nice if we can do an earlier check
28 ; based on IENS and the CTX("SOURCE FILE#")
29 N VALID
30 Q:'$D(CTX)!($G(TIREF)']"") 0
31 S VALID=TIREF?.(.N1",")
32 Q VALID
33 ;
34FINDTERM(CTX,TIREF,TERM) ; find term
35 ; called from FINDTERM^XTIDCTX(CTX,TIREF,TERM)
36 ; find term for given term IREF
37 ; return TERM data as new TERM array
38 N IENS
39 Q:'$D(CTX)!($D(TERM))
40 Q:'$$VALIDREF(.CTX,$G(TIREF))
41 S IENS=$G(TIREF)
42 Q:IENS']""
43 D GETTERM^XTIDCTX(.CTX,CTX("SOURCE FILE#"),IENS,.TERM)
44 Q
45 ;
46SRCHTRMS(CTX,VUID,XTTBARR,MASTER) ; search term index entries
47 ; called from SEARCH^XTIDCTX(CTX,VUID,ARRAY,MASTER)
48 ; FIND^DIC(FILE,IENS,FIELDS,FLAGS,[.]VALUE,NUMBER,[.]INDEXES,
49 ; [.]SCREEN,IDENTIFIER,TARGET_ROOT,MSG_ROOT)
50 N DIERR,FILE,TFILE,INDEXES,MSG,RIEN,VALUE,FLAGS,TARG,MSG,NUMFND
51 N FIELDS,SCREEN
52 S VUID=$G(VUID),MASTER=+$G(MASTER)
53 Q:$G(CTX("TYPE"))'="TABLE"!('VUID)
54 S FILE=CTX("SOURCE FILE#"),INDEXES="AVUID",FLAGS="QX"
55 S FIELDS="@;99.98I"
56 S VALUE(1)=VUID
57 S SCREEN="" I MASTER S SCREEN="I $P(^(""VUID""),""^"",2)"
58 ; get entries
59 D FIND^DIC(FILE,"",FIELDS,FLAGS,.VALUE,"",INDEXES,SCREEN,"","TARG","MSG")
60 Q:$D(MSG("DIERR"))
61 S NUMFND=+$G(TARG("DILIST",0))
62 I NUMFND D ; found entries
63 . N ITM,TEMP
64 . M TEMP=TARG("DILIST",2)
65 . M TEMP=TARG("DILIST","ID")
66 . F ITM=1:1:NUMFND D
67 . . N STATUS,IENS
68 . . S IENS=TEMP(ITM)_","
69 . . S STATUS=$$GETSTAT^XTID(CTX("TERM FILE#"),CTX("TERM FIELD#"),IENS,"")
70 . . S STATUS=STATUS_"^"_TEMP(ITM,99.98)
71 . . D ADDTARRY^XTIDCTX(XTTBARR,CTX("TERM FILE#"),CTX("TERM FIELD#"),IENS,STATUS)
72 . ;
73 ;
74 Q
75 ;
76GETSUBF(FILE,MFIELD) ; get subfile #
77 ; get subfile for the given file and multiple-valued field
78 N DIERR,ATTR,SUBFILE
79 S SUBFILE=""
80 D FIELD^DID(FILE,MFIELD,"","MULTIPLE-VALUED;SPECIFIER;TYPE","ATTR")
81 I ATTR("MULTIPLE-VALUED")=1,ATTR("TYPE")'="WORD-PROCESSING" D
82 . S SUBFILE=+$G(ATTR("SPECIFIER"))
83 ;
84 Q SUBFILE
85 ;
Note: See TracBrowser for help on using the repository browser.