I guess that one code snippet is pretty cryptic. Here's my whole
function BLDFDA. This is a step in copying the (parsed) contents of an
HL7 message to Fileman.


BLDFDA(CSLQD,CSLROOT)   ;
        N MYFDA,I,II,J,K,BASE,MYIENS,FLD,IENS,BIENS,VAL,SFILE,CNT
        N LAST,RSFILE,MYIENS1,FLD1,VAL1,CONPTR,FILE,PRV,STFROM
        S SFILE=$$GET1^DIQ(536.4,CSLQD_",",.09)
        S MYFDA=$NA(^TMP("CSLFDA",$J))
        K @MYFDA ;delete anything there already
        S BASE=$G(@CSLROOT@("HEADER","BASE_IEN"))
        Q:+BASE'>0 "" ;error
        S BIENS=BASE_","
        S FILE=$$QFILE^CSLQY9(CSLQD)
        ;In a continuation message, we may not want to start counting
        ;from zero
        S STFROM=0
        S PRV=$$PREV^CSLQY8(CSLQD,BASE)
        D:+PRV>0
        .S STFROM=$$GET1^DIQ(FILE,PRV_",",50)
        ;Iterate over records
        S I=""
        F  S I=$O(@CSLROOT@("DATA",I)) Q:I=""  D
        .S LAST=I ;last seq no seen
        .S MYIENS="+"_I_","_BIENS
        .;Get sequence number
        .S CNT=+$G(@CSLROOT@("HEADER","INDEX"))
        .S @MYFDA@(SFILE,MYIENS,.01)=STFROM+I ; .01 is seq no
        .;S @MYFDA@(SFILE,MYIENS,.01)=CNT
        .;Now, iterate over "ROOT" nodes
        .S J=""
        .F  S J=$O(@CSLROOT@("DATA",I,"ROOT","VAL",J)) Q:J=""  D
        ..S VAL=$G(@CSLROOT@("DATA",I,"ROOT","VAL",J))
        .. I $F(VAL,"^") S V=VAL,VAL="" D
        ... ;;;; *************************
        ... F II=1:1:$L(V,"^") I $P(V,"^",II)'="" S
VAL=VAL_$P(V,"^",II)_"  "
        ..S @MYFDA@(SFILE,MYIENS,J)=VAL
        ;Start over, and iterate through "CHILD" nodes
        S I=""
        F  S I=$O(@CSLROOT@("DATA",I)) Q:I=""  D
        .D:$D(@CSLROOT@("DATA",I,"CHILD"))
        ..S J=""
        ..F  S J=$O(@CSLROOT@("DATA",I,"CHILD",J)) Q:J=""  D
        ...S RSFILE=$G(@CSLROOT@("DATA",I,"CHILD",J,"HEADER","FILE"))
        ...S MYIENS1="+"_((LAST*I)+J)_","_"+"_I_","_BIENS
        ...S K=""
        ...F  S K=$O(@CSLROOT@("DATA",I,"CHILD",J,"VAL",K)) Q:K=""  D
        ....S FLD1=$G(@CSLROOT@("DATA",I,"CHILD",J,"XREF",K))
        ....S VAL1=$G(@CSLROOT@("DATA",I,"CHILD",J,"VAL",K))
        ....S @MYFDA@(RSFILE,MYIENS1,FLD1)=VAL1
        ...D:$L($G(@MYFDA@(RSFILE,MYIENS1,.01)))'>0
        ....K @MYFDA@(RSFILE,MYIENS1) ;no .01 field!
        S @MYFDA@(FILE,BIENS,50)=$G(@CSLROOT@("COUNT"))+$G(STFROM)
        ;Finally, is there a continuation pointer?
        D:$D(@CSLROOT@("CONTINUATION"))
        .S CONPTR=$G(@CSLROOT@("CONTINUATION"))
        .S @MYFDA@(FILE,BIENS,200)=CONPTR
        ;return name of FDA array
        Q MYFDA

--- Kevin Toppenberg <[EMAIL PROTECTED]> wrote:

> Greg,
> 
> I'm not sure you would be able to make sense of just a
> snipet of the code.
> 
> Let me reformat the FDA below.  The way I was showing
> it below is supposed to be an ASCII representation of
> a data tree.
> 
> FDA(200,"?+1,",.01)= DOE,JOHN
> FDA(200,"?+1,",1)= JD
> FDA(200,"?+1,",7)= NO
> FDA(200,"?+1,",7.2)= YES
> FDA(200,"?+1,",11.2)= TODAY
> FDA(200,"?+1,",20)= UCI
> FDA(200,"?+1,",29)= FAMILY PRACTICE
> FDA(200.02,"?+1,",.01)= TMGDivison
> 
> Again, I'm pretty sure that last line is wrong.
> 
> Thanks
> Kevin
> 
> --- Greg Kreis <[EMAIL PROTECTED]> wrote:
> 
> > I am not sure I can make out what your FDA array is
> > looking like.  Can 
> > you show the setup and call?
> > 
> > Kevin Toppenberg wrote:
> > 
> > >Hey all.  I am having trouble setting up FDA
> > properly.
> > >
> > >Here is the data I want to put into the database:
> > >
> > > FDA(*)
> > > }>200= ''
> > > | }>?+1,= ''
> > > | | }>.01= DOE,KOHN
> > > | | }>1= JD
> > > | | }>7= NO
> > > | | }>7.2= YES
> > > | | }>11.2= TODAY
> > > | | }>20= UCI
> > > | | }>29= FAMILY PRACTICE
> > > }>200.02= ''
> > > | }>?+1,= ''
> > > | | }>.01= TMGDivison
> > >
> > >The problem is that I think I am doing the subfile
> > >wrong.  File 200.02 is really field#16.  So I need
> > to
> > >tell it to put the data into subfile 200.02 INSIDE
> > the
> > >record for the data above.
> > >
> > >I have read the FDA documentation several times,
> > and
> > >it always makes my head hurt.  I'm sure its easy
> > once
> > >one gets the hang of it.  At the WorldVistA
> > >conference, Rick told me he had designed this
> > >interface and that he was sorry. LOL.
> > >
> > >My brain is tired.  Can someone just tell me the
> > >correct format?
> > >
> > >Also, this FDA is to be used with UPDATE^DIE.
> > >When I try the above FDA, I get this error message:
> > >
> > >+===========================================+
> > >| <!> ERROR . . .                           |..
> > >+-------------------------------------------+ :
> > >| Fileman says 'A multi-valued field        | :
> > >| cannot be processed by this utility.      | :
> > >+===========================================+ :
> > >  :............................................
> > >
> > >I don't know if this is related to the issue I am
> > >describing above.  What is Fileman telling me?
> > >
> > >Thanks
> > >Kevin
> > >
> > >
> > >
> > >           
> > >__________________________________ 
> > >Do you Yahoo!? 
> > >Meet the all-new My Yahoo! - Try it today! 
> > >http://my.yahoo.com 
> > > 
> > >
> > >
> > >
> >
> >-------------------------------------------------------
> > >SF email is sponsored by - The IT Product Guide
> > >Read honest & candid reviews on hundreds of IT
> > Products from real users.
> > >Discover which products truly live up to the hype.
> > Start reading now. 
> > >http://productguide.itmanagersjournal.com/
> > >_______________________________________________
> > >Hardhats-members mailing list
> > >[EMAIL PROTECTED]
> >
> >https://lists.sourceforge.net/lists/listinfo/hardhats-members
> > >
> > >  
> > >
> > 
> > 
> > 
> >
> -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT
> > Products from real users.
> > Discover which products truly live up to the hype.
> > Start reading now. 
> > http://productguide.itmanagersjournal.com/
> > _______________________________________________
> > Hardhats-members mailing list
> > [EMAIL PROTECTED]
> >
> https://lists.sourceforge.net/lists/listinfo/hardhats-members
> > 
> 
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> The all-new My Yahoo! - Get yours free! 
> http://my.yahoo.com 
>  
> 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real
> users.
> Discover which products truly live up to the hype. Start reading now.
> 
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Hardhats-members mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hardhats-members
> 


=====
A practical man is a man who practices the errors of his forefathers. 
--Benjamin Disraeli
====
Greg Woodhouse 
[EMAIL PROTECTED] 
[EMAIL PROTECTED] 





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Hardhats-members mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to