Changeset 298 for ccr


Ignore:
Timestamp:
Dec 5, 2008, 3:04:15 PM (16 years ago)
Author:
George Lilly
Message:

fixes to GET and FIELD to handle duplicate field titles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/C0CDIC.m

    r297 r298  
    112112 . . S C0CFN=$P(^DD(C0CFJ,C0CFI,0),"^",1) ;PULL FIELD NAME FROM ^DD
    113113 . . ;W "N: ",C0CFN,!
     114 . . ;I C0CFN="STR" W C0CFN," ",C0CFJ,!
    114115 . . I $D(@C0CFRTN@(C0CFN)) D  ; IS THIS A DUPLICATE?
    115116 . . . W "DUPLICATE FOUND! ",C0CFJ," ",C0CFI," ",C0CFN,!,@C0CFRTN@(C0CFN),!
    116  . . . S @C0CFRTN@("M",@C0CFRTN@(C0CFN),C0CFN)=C0CFJ_"^"_C0CFI
     117 . . . S @C0CFRTN@(C0CFN_"_"_C0CFJ)=C0CFJ_"^"_C0CFI
    117118 . . E  S @C0CFRTN@(C0CFN)=C0CFJ_"^"_C0CFI
    118119 . S C0CFJ=$O(^DD(C0CFJ)) ; NEXT SUBFILE
    119120 Q
    120121 ;
    121 GET(GRTN,GFILE,GIEN) ; RETURN THE DICTIONARY RECORD GIEN IN ARRAY GRTN, PASSED
     122GET(GRTN,GFILE,GIEN,GNN) ; RETURN THE DICTIONARY RECORD GIEN IN ARRAY GRTN, PASSED
    122123 ; BY NAME
    123124 ;
    124  N C0CTMP,C0CI,C0CJ,C0CREF,C0CNAME
     125 ;N C0CTMP,C0CI,C0CJ,C0CREF,C0CNAME
     126 I $D(GNN) I GNN="ALL" S C0CNN=0 ; NOT NON-NULL (ALL FIELDS TO BE RETURNED)
     127 E  S C0CNN=1 ; NON-NULL IS TRUE (ONLY POPULATED FIELDS RETURNED)
    125128 S C0CREF=GIEN_"," ; OPEN ROOT REFERENCE INTO FILE
    126129 D GETS^DIQ(GFILE,C0CREF,"**","","C0CTMP")
     
    132135 . . ;W C0CJ," ",C0CI,!
    133136 . . S C0CNAME=$P(^DD(C0CJ,C0CI,0),"^",1) ;PULL THE FIELD NAME
    134  . . S $P(@GRTN@(C0CNAME),"^",3)=C0CTMP(C0CJ,C0CREF,C0CI) ;RETURN VALUE IN P3
     137 . . S C0CVALUE=C0CTMP(C0CJ,C0CREF,C0CI) ;
     138 . . I C0CVALUE["C0CTMP" S C0CVALUE=C0CTMP(C0CJ,C0CREF,C0CI,1) ;1ST LINE OF WP
     139 . . S $P(@GRTN@(C0CNAME),"^",3)=C0CVALUE ;RETURN VALUE IN P3
     140 I C0CNN D  ; IF ONLY NON-NULL VALUES ARE TO BE RETURNED
     141 . S C0CI=""
     142 . F  S C0CI=$O(@GRTN@(C0CI)) Q:C0CI=""  D  ; GO THROUGH THE WHOLE ARRAY
     143 . . I $P(@GRTN@(C0CI),"^",3)="" K @GRTN@(C0CI) ; KILL THE NULL ENTRIES
    135144 Q
    136145 ;
Note: See TracChangeset for help on using the changeset viewer.