Greg,

Your code has been very helpful.

I don't fully understand these lines
>         .S X=$P(^DD(FNUM,.01,0),"^",2)
>         .S WP=$S(X="W":1,X="WL":2,1:0)
When the second piece="W", or "WL", what is the
significance of these codes?  You don't seem to use WP
in your code.

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
> 



                
__________________________________ 
Discover Yahoo! 
Use Yahoo! to plan a weekend, have fun online and more. Check it out! 
http://discover.yahoo.com/


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to