source: FOIAVistA/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUFLF.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 5.4 KB
Line 
1TIUFLF ; SLC/MAM - Library; File 8925.1 Related: NODE0ARR(FILEDA,NODE0,PFILEDA), HASBOIL(FILEDA,NODE0), DDEFUSED(FILEDA), DESCUSED(FILEDA) ;10/24/95 23:35
2 ;;1.0;TEXT INTEGRATION UTILITIES;;Jun 20, 1997
3 ;
4HASBOIL(FILEDA,NODE0) ;Function Returns 0, 1, 10, or 11 (like $D) if FILEDA/any descendant has Boilerplate Text, or NA if nonapplicable (neither DOC nor CO).
5 ; Requires FILEDA, NODE0.
6 N ANS,ANSONE,ANSTEN
7 I $P(NODE0,U,4)'="DOC"&($P(NODE0,U,4)'="CO") S ANS="NA" G HASBX
8 S ANSONE=+$O(^TIU(8925.1,FILEDA,"DFLT",0)) S:ANSONE ANSONE=1
9 S ANSTEN=$$DHASBOIL(FILEDA)
10 S ANS=ANSTEN_ANSONE
11 I ANS="00" S ANS=0
12 I ANS="01" S ANS=1
13HASBX Q ANS
14 ;
15DHASBOIL(FILEDA) ; Function Returns 1 if any descendant has Boilerplate Text.
16 ; Requires FILEDA.
17 N TIUI,IFILEDA,ANS
18 I '$G(FILEDA) S ANS="ERR" G DHASX
19 S (TIUI,ANS)=0
20 F S TIUI=$O(^TIU(8925.1,FILEDA,10,TIUI)) G:'TIUI!ANS DHASX D
21 . S IFILEDA=+^TIU(8925.1,FILEDA,10,TIUI,0)
22 . I $D(^TIU(8925.1,IFILEDA,"DFLT")) S ANS=1 Q
23 . S ANS=$$DHASBOIL(IFILEDA)
24 . Q
25DHASX Q ANS
26 ;
27NODE0ARR(FILEDA,NODE0,PFILEDA) ; Sets NODE0 = ^TIU(8925.1,FILEDA,0)_U_PIECE20, where
28 ;PIECE20= 0,1,10,11 if FILEDA/any descendant has Boilerplate text
29 ;(Like $D), or NA.
30 ; IF NODE0 IS NOT NULL, Passes back NODE0 as an array. If NODE0 is null,
31 ;doesn't set subscripts, writes warning.
32 ; When return from this call, if FILEDA is not already on the screen but taken from an item multiple, a name xfef, etc, check for NODE0="". This will catch broken pointers to 8925.1.
33 ; Sets Subscript TYPE = Stnd Abbrev = ^TMP("TIUF",$J,"TYPE"_INTERNALTYPE)). See TIUFL.
34 ; Sets Subscripts COWNER, STATUS = Mixed case(external value);
35 ; Sets Subscript POWNER = external value;
36 ; Sets Subscript NATL= Yes, or No;
37 ; Sets Subscript SHARE = Yes, No, or "" for NA;
38 ; Sets Subscript ORPHAN = Yes, No, or "" for NA (Object);
39 ; Sets Subscript ITEMS = Yes, No, or "" for NA (Object);
40 ; Sets Subscript BOILPT = Yes if entry or descendants have Boiltxt, No, or "" for NA (Type not Doc or CO);
41 ; Sets Subscript INUSE = Yes, No, ?, or "" for NA (Object).
42 ; Requires FILEDA = file 8925.1 IFN of 8925.1 entry.
43 ; Optional PFILEDA = parent IFN of FILEDA. Used for Computed Field .08 In Use for EN^DIQ.
44 S NODE0=$G(^TIU(8925.1,FILEDA,0))
45 I '$D(PFILEDA) S PFILEDA=0
46 I PFILEDA,NODE0="" W !!," File entry "_PFILEDA_" has Nonexistent Item "_FILEDA_"; See IRM.",! D PAUSE^TIUFXHLX G NODEX
47 I NODE0="" W !!," ",FILEDA_" doesn't exist in the file; See IRM.",! D PAUSE^TIUFXHLX G NODEX
48 N DIC,DA,DR,TIUFQ,SHARE,ORPHAN,BOILPT,TYPE,ITEMS,DIQ,USED
49 S DIC=8925.1,DR=".04:.13",DIQ(0)="I,E",DA=FILEDA,DIQ="TIUFQ" D EN^DIQ1
50 S TYPE=$G(TIUFQ(8925.1,FILEDA,.04,"I")) S:TYPE="DOC" TYPE="TL"
51 S NODE0("TYPE")=$G(^TMP("TIUF",$J,"TYPE"_TYPE))
52 S NODE0("POWNER")=$G(TIUFQ(8925.1,FILEDA,.05,"E"))
53 S NODE0("COWNER")=$$MIXED^TIULS($G(TIUFQ(8925.1,FILEDA,.06,"E")))
54 S NODE0("STATUS")=$$MIXED^TIULS($G(TIUFQ(8925.1,FILEDA,.07,"E")))
55 S NODE0("NATL")=$$MIXED^TIULS($G(TIUFQ(8925.1,FILEDA,.13,"E")))
56 I NODE0("NATL")="" S NODE0("NATL")="No"
57 S USED=$G(TIUFQ(8925.1,FILEDA,.08,"E")),NODE0("INUSE")=$S(USED="NA":"",USED="?":"?",1:$$MIXED^TIULS(USED))
58 S SHARE=$G(TIUFQ(8925.1,FILEDA,.1,"E"))
59 S NODE0("SHARE")=$S(SHARE="YES":"Yes",SHARE="NO":"No",SHARE=""&(TYPE'="O"):"No",1:"")
60 S ORPHAN=$$ORPHAN^TIUFLF4(FILEDA,NODE0)
61 S NODE0("ORPHAN")=$S(ORPHAN="NA":"",1:$$MIXED^TIULS(ORPHAN))
62 S BOILPT=$$HASBOIL(FILEDA,NODE0),$P(NODE0,U,20)=BOILPT
63 S NODE0("BOILPT")=$S(BOILPT="NA":"",BOILPT:"Yes",1:"No")
64 S ITEMS=$S($O(^TIU(8925.1,FILEDA,10,0)):1,1:0)
65 S NODE0("ITEMS")=$S(ITEMS:"Yes",$P(NODE0,U,4)="O":"",1:"No")
66NODEX Q
67 ;
68DESCUSED(FILEDA) ; Function returns 1 if FILEDA has
69 ;descendant item of Type DOC with TIU documents (file 8925 entries)
70 ;pointing to it; Else returns 0.
71 ; Assumes DDEFs cannot be reused Except SHARED Components; stops
72 ;check at DOC level. It is enough to check descendants down to type
73 ;DOC since if a component is used, its ancestor of type DOC is used.
74 ;Therefore reusing COMPONENTS does not present a difficulty for
75 ;DDEFUSED or for DESCUSED IF CHECKING FOR USE STOPS AT THE DOC LEVEL
76 ;AND DOES NOT CHECK COMPONENTS.
77 ; Requires FILEDA.
78 ; Requires FILEDA's node 0 to exist.
79 N DESCANS,TIUI,IFILEDA,ITYPE,INODE0
80 S (TIUI,DESCANS)=0
81 F S TIUI=$O(^TIU(8925.1,FILEDA,10,TIUI)) Q:'TIUI D Q:DESCANS=1
82 . S IFILEDA=+^TIU(8925.1,FILEDA,10,TIUI,0)
83 . I $O(^TIU(8925,"B",IFILEDA,0)) S DESCANS=1 Q
84 . S INODE0=$G(^TIU(8925.1,IFILEDA,0)),ITYPE=$P(INODE0,U,4)
85 . I INODE0="" S DESCANS="?" Q
86 . I ITYPE="DOC" Q
87 . S DESCANS=$$DESCUSED(IFILEDA)
88 . Q
89DESCX Q DESCANS
90 ;
91DDEFUSED(FILEDA) ; Function called by 8925.1 computed field .08 USED BY DOCMTS.
92 ; Assumes DDEFs CANNOT be reused except for SHARED Components.
93 ; Returns YES if FILEDA is pointed to by 8925 docmts or components.
94 ; YES if FILEDA itself is not pointed to, but descendants
95 ; of Type DOC(Title) under FILEDA in the hierarchy are
96 ; pointed to.
97 ; NA if FILEDA has Type Object.
98 ; ? if not known to be YES and FILEDA has Item w broken pointer.
99 ; NO if not YES, not ?, and not NA.
100 ; Requires FILEDA = 8925.1 IFN of Entry.
101 ; Requires Node 0 of FILEDA to exist.
102 N DDEFUSED,NODE0,TYPE,DESCUSED
103 S NODE0=^TIU(8925.1,FILEDA,0),DDEFUSED=0
104 I $O(^TIU(8925,"B",FILEDA,0)) S DDEFUSED="YES" G DDEFX
105 S TYPE=$P(NODE0,U,4)
106 I TYPE="O" S DDEFUSED="NA" G DDEFX
107 I TYPE="DOC" S DDEFUSED="NO" G DDEFX
108 S DESCUSED=$$DESCUSED(FILEDA)
109 S DDEFUSED=$S(DESCUSED:"YES",DESCUSED="?":"?",1:"NO")
110DDEFX Q DDEFUSED
111 ;
Note: See TracBrowser for help on using the repository browser.