| 1 | TIUFLT ; SLC/MAM - Library; Template T (Items) Related: BUFITEMS(CONTENT,EINFO,LASTLIN), ITEMS(FILEDA) ;4/6/95  11:02
 | 
|---|
| 2 |  ;;1.0;TEXT INTEGRATION UTILITIES;;Jun 20, 1997
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | BUFITEMS(CONTENT,EINFO,LASTLIN) ; Set items of Entry EINFO into
 | 
|---|
| 5 |  ;Buffer array in proper order.
 | 
|---|
| 6 |  ; Requires CONTENT = String containing some or all of: 80, H, C, A, D, T, W.  See BUFENTRY^TIUFLLM2.
 | 
|---|
| 7 |  ; Requires EINFO, where EINFO is either as set in NINFO^TIUFLLM or
 | 
|---|
| 8 |  ;is = ^TMP("TIUFIDX,$J,LINENO).
 | 
|---|
| 9 |  ; Requires LASTLIN=LM array line before item insertion point.
 | 
|---|
| 10 |  ; Requires all of the entry's items to exist in the file: check before calling this module.
 | 
|---|
| 11 |  ; Updates LASTLIN to last line set in buffer array, ie 
 | 
|---|
| 12 |  ;buffer array starts with line [received LASTLIN+1] and ends with
 | 
|---|
| 13 |  ;line [returned LASTLIN].
 | 
|---|
| 14 |  N FILEDA,TIUFITEM,LINENO,TIUFI,IFILEDA,ITENDA,INFO,INODE0
 | 
|---|
| 15 |  S FILEDA=$P(EINFO,U,2)
 | 
|---|
| 16 |  I TIUFTMPL="C",TIUFCLPS S TIUFITEM(1)=TIUFCDA_U_TIUFCTDA
 | 
|---|
| 17 |  E  D ITEMS(FILEDA)
 | 
|---|
| 18 |  K ^TMP("TIUFB",$J),^TMP("TIUFBIDX",$J)
 | 
|---|
| 19 |  S LINENO=LASTLIN
 | 
|---|
| 20 |  F TIUFI=1:1 Q:'$G(TIUFITEM(TIUFI))  D  Q:$D(DTOUT)
 | 
|---|
| 21 |  . S IFILEDA=$P(TIUFITEM(TIUFI),U),ITENDA=$P(TIUFITEM(TIUFI),U,2) Q:'IFILEDA  Q:'ITENDA
 | 
|---|
| 22 |  . S LINENO=LINENO+1 ;Needed by NINFO.
 | 
|---|
| 23 |  . D NINFO^TIUFLLM(LINENO,IFILEDA,.INFO,EINFO,ITENDA),PARSE^TIUFLLM(.INFO)
 | 
|---|
| 24 |  . D NODE0ARR^TIUFLF(IFILEDA,.INODE0,FILEDA) Q:$D(DTOUT)
 | 
|---|
| 25 |  . I INODE0="" S LINENO=LINENO-1 Q
 | 
|---|
| 26 |  . D BUFENTRY^TIUFLLM2(.INFO,.INODE0,CONTENT,FILEDA) I TIUFI>5 W "."
 | 
|---|
| 27 |  . Q
 | 
|---|
| 28 |  S LASTLIN=LINENO
 | 
|---|
| 29 |  Q
 | 
|---|
| 30 |  ;
 | 
|---|
| 31 | ITEMS(FILEDA) ; Sets items of FILEDA into array TIUFITEM in proper order.
 | 
|---|
| 32 |  ; TIUFITEM(TIUFI)=Item's 8925.1 IFN^Item's IFN in Item multiple
 | 
|---|
| 33 |  ; Requires FILEDA = Entry's 8925.1 IFN
 | 
|---|
| 34 |  N TIUFI,SEQ,TENDA,TENODE0,NAME
 | 
|---|
| 35 |  S (TIUFI,SEQ,TENDA)=0
 | 
|---|
| 36 |  F  S SEQ=$O(^TIU(8925.1,FILEDA,10,"AC",SEQ)) Q:'SEQ  D
 | 
|---|
| 37 |  . ; Set items having sequence into TIUFITEM in sequence order
 | 
|---|
| 38 |  . F  S TENDA=$O(^TIU(8925.1,FILEDA,10,"AC",SEQ,TENDA)) Q:'TENDA  D
 | 
|---|
| 39 |  . . S TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0) Q:'TENODE0
 | 
|---|
| 40 |  . . S TIUFI=TIUFI+1,TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
 | 
|---|
| 41 |  S NAME=""
 | 
|---|
| 42 |  F  S NAME=$O(^TIU(8925.1,FILEDA,10,"C",NAME)) Q:NAME=""  D
 | 
|---|
| 43 |  . ; Set items with no sequence into TIUFITEM in alpha order by Display Name.
 | 
|---|
| 44 |  . S TENDA=0
 | 
|---|
| 45 |  . F  S TENDA=$O(^TIU(8925.1,FILEDA,10,"C",NAME,TENDA)) Q:'TENDA  D
 | 
|---|
| 46 |  . . S TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0) Q:'TENODE0
 | 
|---|
| 47 |  . . Q:$P(TENODE0,U,3)  ;If has sequence, already in TIUFITEM.
 | 
|---|
| 48 |  . . S TIUFI=TIUFI+1,TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
 | 
|---|
| 49 |  S TENDA=0
 | 
|---|
| 50 |  F  S TENDA=$O(^TIU(8925.1,FILEDA,10,TENDA)) Q:'TENDA  D
 | 
|---|
| 51 |  . ; Set items with no sequence, no display name into buffer in item order
 | 
|---|
| 52 |  . S TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0) Q:'TENODE0
 | 
|---|
| 53 |  . Q:$P(TENODE0,U,3)  ;If has sequence, already in TIUFITEM.
 | 
|---|
| 54 |  . Q:$P(TENODE0,U,4)'=""  ;If has Display Name, already in TIUFITEM.
 | 
|---|
| 55 |  . S TIUFI=TIUFI+1,TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
 | 
|---|
| 56 |  Q
 | 
|---|
| 57 |  ;
 | 
|---|