source: FOIAVistA/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIURECL2.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: 3.7 KB
Line 
1TIURECL2 ; SLC/MAM - Expand/collapse LM views ;1/22/01
2 ;;1.0;TEXT INTEGRATION UTILITIES;**100**;Jun 20, 1997
3 ; 7/6 Split TIURECL into TIURECL & TIURECL1, move RESOLVE to TIURECL1
4 ; 7/10 Move INSID, INSADD, VEXREQ, ISSUB to TIURECL1
5 ; 9/7 Move INSKIDS, INSADD & associated mods from TIURECL1 TO ECL2
6 ;=======================================================================
7INSKIDS(TSTART,TIUDA,PRNTPFIX,SORTBY) ;Insert ID kids
8 ;of parent TIUDA into array ^TMP("TMPLIST",$J) in SORTBY order
9 ; Receives TSTART, TIUDA, PRNTPFIX, SORTBY
10 ; TIUDA = ID parent
11 ; PRNTPFIX = prefix of parent, updated for current expand action.
12 ; SORTBY = "REFDT" or "TITLE"
13 N KIDDATA,KIDDA,TEXT,FRSTPFIX,ORIGPFIX,NEWPFIX,KIDLIST,TIUK
14 ; -- If ID parent has addenda at the parent level,
15 ; as well as ID kids, then first insert addenda: --
16 I $$HASADDEN^TIULC1(TIUDA) S TSTART=$$INSADD(TSTART,TIUDA,PRNTPFIX)
17 ; -- Get list of ID kids in ref date or title order: --
18 D GETIDKID(TIUDA,SORTBY)
19 ; -- Set LIST(TSTART)=TEXT_U_KIDDA_U_NEWPFIX and
20 ; ^TMP("TMPLIST",$J,"IDDATA",KIDDA)
21 S TIUK=0
22 F S TIUK=$O(^TMP("TIUIDKID",$J,TIUDA,TIUK)) Q:'TIUK D
23 . S KIDDA=^TMP("TIUIDKID",$J,TIUDA,TIUK)
24 . S TSTART=TSTART+1
25 . S ^TMP("TMPLIST",$J,TSTART)=$$GETLINE(KIDDA,PRNTPFIX,TSTART,.KIDDATA)
26 . S ^TMP("TMPLIST",$J,"IDDATA",KIDDA)=KIDDATA
27 K ^TMP("TIUIDKID",$J)
28 Q TSTART
29 ;
30GETIDKID(TIUDA,SORTBY) ; Set ^TMP("TIUIDKID",$J,TIUDA,TIUK) = KIDDA,
31 ; array of ID kids of TIUDA, in SORTBY order
32 N KIDDA,REFDT,TITLE,TIUJ,LIST,TIUK
33 S KIDDA=0,TIUJ=0
34 F S KIDDA=$O(^TIU(8925,"GDAD",TIUDA,KIDDA)) Q:+KIDDA'>0 D
35 . S TIUJ=TIUJ+1
36 . S REFDT=$P(^TIU(8925,KIDDA,13),U)
37 . I SORTBY="REFDT" S LIST("HOLDER",REFDT,TIUJ)=KIDDA
38 . I SORTBY="TITLE" S TITLE=$$PNAME^TIULC1(+^TIU(8925,KIDDA,0)),LIST(TITLE,REFDT,TIUJ)=KIDDA
39 ; -- Flatten the list: --
40 S TITLE="",REFDT=0,TIUJ=0,TIUK=0
41 F S TITLE=$O(LIST(TITLE)) Q:TITLE="" D
42 . F S REFDT=$O(LIST(TITLE,REFDT)) Q:'REFDT D
43 . . F S TIUJ=$O(LIST(TITLE,REFDT,TIUJ)) Q:'TIUJ D
44 . . . S TIUK=TIUK+1
45 . . . S ^TMP("TIUIDKID",$J,TIUDA,TIUK)=LIST(TITLE,REFDT,TIUJ)
46 Q
47 ;
48GETLINE(KIDDA,PRNTPFIX,LINENO,TIUGDATA) ; Return LINE=TEXT_U_KIDDA_U_NEWPFIX
49 ; Find & pass back TIUGDATA
50 N LINE,ORIGPFIX,NEWPFIX,TEXT,FRSTPFIX
51 S ORIGPFIX=$$PREFIX^TIULA2(KIDDA)
52 S FRSTPFIX=$$FRSTPFIX(PRNTPFIX)
53 S TEXT=$$RESOLVE^TIURECL1(KIDDA,LINENO,FRSTPFIX,.TIUGDATA)
54 S NEWPFIX=FRSTPFIX_ORIGPFIX
55 S LINE=TEXT_U_KIDDA_U_NEWPFIX
56 Q LINE
57 ;
58FRSTPFIX(PRNTPFIX) ; Return first part of Prefix for Inserted addm
59 ;or ID kid of parent.
60 ; Receives PRNTPFIX; returns FRSTPFIX.
61 ; PRNTPFIX = prefix of parent, updated for current expand action.
62 ; -- Build first part of kid prefix using PRNTPFIX: --
63 ; EX: if updated prefix of parent is " |_- ",
64 ; then build FRSTPFIX from left to right:
65 ; Take beginning spaces " ", keep the "|", replace the _
66 ; with a space, replace INDicators (& the following space)
67 ; with spaces, and tack on "|_" to get: " | |_"
68 ; Prefix of kid is then FRSTPFIX_(Original prefix of kid).
69 N INDLNGTH,INDSPACE,FRSTPFIX
70 I PRNTPFIX["|_" S INDLNGTH=$L($P(PRNTPFIX,"|_",2)) I 1
71 E S INDLNGTH=$L(PRNTPFIX)
72 S INDSPACE="",$P(INDSPACE," ",INDLNGTH+1)=""
73 I PRNTPFIX["|_" S FRSTPFIX=$P(PRNTPFIX,"|_")_"| "_INDSPACE_"|_" I 1
74 E S FRSTPFIX=INDSPACE_"|_"
75 Q FRSTPFIX
76 ;
77INSADD(TSTART,TIUDA,PRNTPFIX) ;Insert addenda of parent TIUDA into ^TMP("TMPLIST",$J).
78 ; Receives TSTART, TIUDA, PRNTPFIX
79 ; PRNTPFIX = prefix of parent, updated for current expand action.
80 N KIDDA,TEXT,FIRSTPFX,ORIGPFIX,NEWPFIX
81 S KIDDA=0
82 F S KIDDA=$O(^TIU(8925,"DAD",TIUDA,KIDDA)) Q:+KIDDA'>0 D
83 . I '+$$ISADDNDM^TIULC1(+KIDDA) Q
84 . S TSTART=TSTART+1
85 . S ^TMP("TMPLIST",$J,TSTART)=$$GETLINE(KIDDA,PRNTPFIX,TSTART)
86 Q TSTART
Note: See TracBrowser for help on using the repository browser.