Thanks for the code.  I may well use it.

Thanks
Kevin


--- Greg Woodhouse <[EMAIL PROTECTED]>
wrote:

> Hee's a slightly modified version of some code I
> wrote to recursively
> traverse a file entry. You could probably adapt it
> to produce an XML
> serialization of the file. (Note that I originally
> wrote this using
> GETS^DIQ, but according to my benchmarks, that
> version was much too
> slow).
> 
> TRAVERSE(FNUM,IEN,SREF)   ;
>         N
>
VAL,FLD,TYPE,STORE,NODE,POS,IVAL,OROOT,GREF,RANGE,FIRST,LAST
>         N SFILE,SROOT,CROOT,SREC,VAL2,LABEL,WP,X
>         I $G(SREF)'="" D
>         .S X=$P(^DD(FNUM,.01,0),"^",2)
>         .S WP=$S(X="W":1,X="WL":2,1:0)
>         S VAL=0
>         I $G(SREF)="" D
>         .S OROOT=$G(^DIC(FNUM,0,"GL"))
>         E  S OROOT=SREF
>         Q:OROOT="" 0
>         S FLD=0
>         F  S FLD=$O(^DD(FNUM,FLD)) Q:+FLD'>0  D
>         .S TYPE=$P($G(^DD(FNUM,FLD,0)),"^",2)
>         .S LABEL=$P($G(^DD(FNUM,FLD,0)),"^",1)
>         .S STORE=$P($G(^DD(FNUM,FLD,0)),"^",4)
>         .S NODE=$P(STORE,";",1)
>         .Q:NODE=""  ;computed field
>         .S POS=$P(STORE,";",2)
>         .S GREF=OROOT_IEN_","_NODE_")"
>         .I POS?1.N D
>         ..S IVAL=$P($G(@GREF),"^",POS)
>         .I POS=0 D
>         ..;multiple
>         ..S SFILE=+TYPE
>         ..S SROOT=OROOT_IEN_","_NODE_","
>         ..S CROOT=$E(SROOT,1,$L(SROOT)-1)_")"
> ;closed root
>         ..S SREC=0
>         ..F  S SREC=$O(@CROOT@(SREC)) Q:+SREC'>0  D
>         ...;descend into subfile
>         ...S VAL2=$$TRAVERSE(SFILE,SREC,SROOT)
>         ...S VAL=$$STUFF(VAL,VAL2)
>         .I POS?1"E"1.N1","1.N D
>         ..;extract format
>         ..S RANGE=$E(NODE,2,999)
>         ..S FIRST=$P(NODE,",",1),LAST=$P(NODE,",",2)
>         ..S IVAL=$E($G(@GREF),FIRST,LAST)
>         I $G(IVAL)'="" S
> VAL=$$STUFF(VAL,IVAL_$C(13)_LABEL)
>         Q VAL
> 
> --- Kevin Toppenberg <[EMAIL PROTECTED]> wrote:
> 
> > One of my goals for my site has been the ability
> to
> > get data back out of VistA in a painless manner. 
> For
> > me this means XML. And I am rapidly nearing the
> point
> > where I plan on finishing this project.
> > 
> > I have a couple of approaches I could take, and
> I'd
> > like input from the list
> > 
> > 1. Write a custom program that dumps progress
> notes
> > (currently the only unique data being stored in
> our
> > VistA) in XML format.  I think I could very easily
> do
> > this.
> > 
> > 2. Writing an extension to fileman's data export
> > abilities, to include an option for XML.  This
> would
> > be the better option in the long run, but probably
> > would be a good deal more difficult for me.  I
> would
> > need to fully understand the current system to
> decide
> > how best to integrate.  Usha recently posted about
> her
> > difficulty using the export functions.  I don't
> think
> > anyone responded with an answer.
> > 
> > What do export templates do?  What file are they
> > stored in?
> > 
> > Has anyone else already done this?  Anything I
> should
> > know before I rush off to reinvent the wheel?
> > 
> > Thanks
> > Kevin
> > 
> > 
> > 
> >             
> > __________________________________ 
> > Discover Yahoo! 
> > Find restaurants, movies, travel and more fun for
> the weekend. Check
> > it out! 
> > http://discover.yahoo.com/weekend.html 
> > 
> > 
> > 
> >
>
-------------------------------------------------------
> > This SF.Net email is sponsored by: NEC IT Guy
> Games.  How far can you
> > shotput
> > a projector? How fast can you ride your desk chair
> down the office
> > luge track?
> > If you want to score the big prize, get to know
> the little guy.  
> > Play to win an NEC 61" plasma display:
> http://www.necitguy.com/?r=20
> > _______________________________________________
> > Hardhats-members mailing list
> > Hardhats-members@lists.sourceforge.net
> >
>
https://lists.sourceforge.net/lists/listinfo/hardhats-members
> > 
> 
> 
> "The most profound technologies are those that
> disappear."
> --Mark Weiser
> 
> ====
> Greg Woodhouse 
> [EMAIL PROTECTED] 
> [EMAIL PROTECTED] 
> 
> 
> 
> 
> 
> 
>
-------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games.
>  How far can you shotput
> a projector? How fast can you ride your desk chair
> down the office luge track?
> If you want to score the big prize, get to know the
> little guy.  
> Play to win an NEC 61" plasma display:
> http://www.necitguy.com/?r=20
> _______________________________________________
> Hardhats-members mailing list
> Hardhats-members@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/hardhats-members
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to