A sort template will allow you to select the records you want to output. A print template will let you select the fields from that record and the format of the output of those fields. So I assume what you may want is a sort template. But maybe you should do it in Mumps. I do not know XML so I am not sure I understand the issue.
Jim

----- Original Message ----- From: "Kevin Toppenberg" <[EMAIL PROTECTED]>
To: <hardhats-members@lists.sourceforge.net>
Sent: Tuesday, June 14, 2005 4:40 PM
Subject: Re: [Hardhats-members] XML data export


OK,

I now have a program that will dump out data from the
files in XML format.  It takes an array something like
this:
 Array(8925,1234)
 Array(8925,1235)
 Array(8925,1236)
 Array(8925,1237)
 Array(200,73)
 Array(22705,"*")

And dumps the records in XML.
Currenly the tags are just the Labels for each field.

To do:
 *redirect screen output to user-defined device
 *Create an user interface for choosing files/records
to dump
 *Create a file to contain optional mapping between
fields and custom XML tags.
 *Learn how to use fileman templates to create above
array (would this be an input template, sort template,
or print template?)

Kevin

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

You should use the Fileman APIs, anyway. I wrote
this for a daemon
process that I wanted to be as light on the system
as possible.

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

> Thanks Greg.  I decided to go ahead and use
FIELD^DID
> to get the information.  I'm concerned that I
wouldn't
> be aware of all the variations on a theme that I
might
> encounter.
>
> Kevin
>
>
> --- Greg Woodhouse
<[EMAIL PROTECTED]>
> wrote:
>
> > My mistake. Try looking at the .01 field of the
> > subfile associated with
> > the WP field. You should see something like
> >
> > ^DD(8925.02,.01,0) = REPORT TEXT^W^^0;1^Q
> >
> > --- Kevin Toppenberg <[EMAIL PROTECTED]> wrote:
> >
> > > When I look at file 8925, field 2 is a WP
field,
> > but I
> > > don't see the W or WL symbols.  Only a node
> > > specification of TEXT.  And in instances of
> > processing
> > > the TEXT node, when I tried to print WP, it
was 0
> > (as
> > > expected per the code).
> > >
> > > So I don't see that the W symbol is being
used.
> > >
> > > Kevin
> > >
> > >
> > > GTM>zwr ^DD(8925,2,*)
> > > ^DD(8925,2,0)="REPORT TEXT^8925.02^^TEXT;0"
> > > ^DD(8925,2,21,0)="^^1^1^2961217^^"
> > > ^DD(8925,2,21,1,0)="This is a word processing
> > field
> > > that contains the report tex
> > > t."
> > >
> > >
> > > GTM>zwr ^DD(8925,.01,0)
> > > ^DD(8925,.01,0)="DOCUMENT
> > > TYPE^RP8925.1'O^TIU(8925.1,^0;1^Q"
> > >
> > >
> > >
> > > --- Greg Woodhouse
> > <[EMAIL PROTECTED]>
> > > wrote:
> > >
> > > > That's right. The point of this code is to
> > quickly
> > > > traverse a file
> > > > entry without actually making FM calls. I
don't
> > do
> > > > anything special
> > > > with WP fields here, so that value isn't
used.
> > > > However, if you actually
> > > > wanted to do something with the data, you'd
want
> > to
> > > > know if a subfile
> > > > was a multiple, or if it contained a WP
field
> > with
> > > > or without line
> > > > wrap.
> > > >
> > > > Of course, the right way to fetch WP
contents
> > (if
> > > > you want to follow
> > > > standards)is with GETS^DIQ or $$GET1^DIQ.
> > > >
> > > > --- Kevin Toppenberg <[EMAIL PROTECTED]>
wrote:
> > > >
> > > > > 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:

=== message truncated ===




__________________________________
Discover Yahoo!
Have fun online with music videos, cool games, IM and more. Check it out!
http://discover.yahoo.com/online.html


-------------------------------------------------------
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



-------------------------------------------------------
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