Hi Jeff,
Thanks for the reply. We had a look at the document you mentioned and found a 
few tips within.
I ended up adding a map item in the &XML& file which we're deploying tomorrow.
Cheers
Peter




-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jeff Schasny
Sent: Wednesday, 6 February 2013 3:03
To: U2 Users List
Subject: Re: [U2] UV: Generating XML from Retrieve

You might take a look at Cedarrville's DOWNLOAD utility

ftp://ftp.cedarville.edu/download/download.pdf

Peter Cheney wrote:
> Hi Everyone,
>
> Hoping someone can help me here or at least point me in the right direction 
> please.
>
> I am trying to generate xml output via a retrieve sentence so that a single 
> valued field is either a) the parent to 3 multi-valued fields, or b) nested 
> correctly within a parent element along with multi-valued fields.
>
> The sentence is using the TOXML and ELEMENTS keywords. According to the 
> retrieve manual due to the inclusion of the ELEMENTS keyword the output is 
> "element-centric".
>
> I think what I need to do is specify attribute-centric output for just the 
> few dictionary items listed below. According to the manual this is called 
> "Mixed Mode". Can this be done in a mapping file?
>
> Also can I use a file other than &XML& to store a custom mapping file? 
> If so how do I do this? (Why? Because some genius designed our app to 
> use the &XML& file for other data as well and as a consequence it gets 
> cleared out regularly.)
>
> Will a mapping file allow me to customise how the dictionary items are output 
> and can this output be nested as desired below?
> I've already made an association called PENDING_AUTHS for the three MV'd 
> fields AUTH_NUMBER, AUTH_DATE, & AUTH_AMOUNT and these are all converted but 
> in the element centric mode thus:
> <FILENAME2>
>   <_ID>999999999</_ID>
>   <REPAY_AMOUNT>538.99</REPAY_AMOUNT>
>   <NEXT_DUE>02 SEP 2012</NEXT_DUE>
>   <AUTH_TOTAL>99.00</AUTH_TOTAL>
>   <PENDING_AUTHS_MV>
>     <AUTH_NUMBER>123456</AUTH_NUMBER>
>     <AUTH_DATE>22/01/13</AUTH_DATE>
>     <AUTH_AMOUNT>40.00</AUTH_AMOUNT>
>   </PENDING_AUTHS_MV>
>   <PENDING_AUTHS_MV>
>     <AUTH_NUMBER>654321</AUTH_NUMBER>
>     <AUTH_DATE>23/01/13</AUTH_DATE>
>     <AUTH_AMOUNT>59.00</AUTH_AMOUNT>
>   </PENDING_AUTHS_MV>
>
> If I change the dictionary item AUTH_TOTAL from S to M and add it to the 
> association then I get that repeated within the PENDING_AUTHS node, the first 
> one has the data and the remainder are empty like this:
> <FILENAME2>
>   <_ID>999999999</_ID>
>   <REPAY_AMOUNT>538.99</REPAY_AMOUNT>
>   <NEXT_DUE>02 SEP 2012</NEXT_DUE>
>   <PENDING_AUTHS_MV>
>     <AUTH_TOTAL>99.00</AUTH_TOTAL>
>     <AUTH_NUMBER>123456</AUTH_NUMBER>
>     <AUTH_DATE>22/01/13</AUTH_DATE>
>     <AUTH_AMOUNT>40.00</AUTH_AMOUNT>
>   </PENDING_AUTHS_MV>
>   <PENDING_AUTHS_MV>
>     <AUTH_TOTAL/>
>     <AUTH_NUMBER>654321</AUTH_NUMBER>
>     <AUTH_DATE>23/01/13</AUTH_DATE>
>     <AUTH_AMOUNT>59.00</AUTH_AMOUNT>
>   </PENDING_AUTHS_MV>
>
> So I tried to wrap this a basic subroutine but I couldn't get that to work 
> either since I couldn't work out the correct syntax of the array to return. 
> Is there a place that documents this? Everything I tried just mangled the 
> data.
>
> Ideally what I'd like to get is something like this:
> <FILENAME2>
>   <_ID>999999999</_ID>
>   <REPAY_AMOUNT>538.99</REPAY_AMOUNT>
>   <NEXT_DUE>02 SEP 2012</NEXT_DUE>
>   <AUTHS TOTAL="99.00">
>     <AUTH NUMBER="123456" DATE="22/01/13" AMOUNT="40.00"</AUTH>
>     <AUTH_NUMBER="654321" DATE="23/01/13" AMOUNT="59.00"</AUTH>
>   </AUTHS>
>
> or even this would do:
> <FILENAME2>
>   <_ID>999999999</_ID>
>   <REPAY_AMOUNT>538.99</REPAY_AMOUNT>
>   <NEXT_DUE>02 SEP 2012</NEXT_DUE>
>   <PENDING_AUTHS_MV>
>     <TOTAL>99.00</TOTAL>
>     <AUTH>
>       <AUTH_NUMBER>123456</AUTH_NUMBER>
>       <AUTH_DATE>22/01/13</AUTH_DATE>
>       <AUTH_AMOUNT>40.00</AUTH_AMOUNT>
>     </AUTH>
>     <AUTH>
>       <AUTH_NUMBER>654321</AUTH_NUMBER>
>       <AUTH_DATE>23/01/13</AUTH_DATE>
>       <AUTH_AMOUNT>59.00</AUTH_AMOUNT>
>     </AUTH>
>   </PENDING_AUTHS_MV>
>
> Not really fussy about the element names. Just wondering if I can achieve the 
> correct element structure/nesting if I employ a mapping to create a mixed 
> mode xml document?
>
> Any tips for where to start with the mapping? Do I need to specify all map 
> elements or can I leave out unwanted ones to their system defaults? Will this 
> map affect all xml output in the same file or just those dictionary items 
> specifically in the map?
>
> Many thanks in advance,
> Cheers
> Peter
>
>
> Dictionary items
> PENDING_AUTHS
> 2 lines long.
>
> ----: P
> 0001: PH
> 0002: AUTH_NUMBER AUTH_DATE AUTH_AMOUNT Bottom at line 2.
> ----: EX
>
> AUTH_TOTAL
> SELECTed record name = "AUTH_TOTAL".
> This is a Type "I" Descriptor last compiled on 05/02/13 at 09:49.
> 20 lines long.
>
> ----: L7
> 0001: I
> 0002: EXTRACT(RAISE(TRANS("FILENAME1",ACCOUNT,10,"X")),1,1,1)
> 0003: MD2
> 0004: Total▒Auths.
> 0005: 15R
> 0006: S
> 0007:
> ----: EX
>
> AUTH_NUMBER
> SELECTed record name = "AUTH_NUMBER".
> This is a Type "I" Descriptor last compiled on 05/02/13 at 10:24.
> 20 lines long.
>
> ----: L7
> 0001: I
> 0002: EXTRACT(RAISE(TRANS("FILENAME1",ACCOUNT,11,"X")),1,0,0)
> 0003:
> 0004: Auth.▒Number
> 0005: 10R
> 0006: M
> 0007: PENDING_AUTHS
> ----: EX
>
> AUTH_DATE
> SELECTed record name = "AUTH_DATE".
> This is a Type "I" Descriptor last compiled on 05/02/13 at 10:24.
> 20 lines long.
>
> ----: L7
> 0001: I
> 0002: EXTRACT(RAISE(TRANS("FILENAME1",ACCOUNT,12,"X")),1,0,0)
> 0003: D2/
> 0004: Auth.▒Date
> 0005: 8R
> 0006: M
> 0007: PENDING_AUTHS
> ----: EX
>
> AUTH_AMOUNT
> SELECTed record name = "AUTH_AMOUNT".
> This is a Type "I" Descriptor last compiled on 05/02/13 at 10:24.
> 20 lines long.
>
> ----: L7
> 0001: I
> 0002: EXTRACT(RAISE(TRANS("FILENAME1",ACCOUNT,13,"X")),1,0,0)
> 0003: MD2
> 0004: Auth.▒Amount
> 0005: 12R
> 0006: M
> 0007: PENDING_AUTHS
> ----: EX
>
>
>
>  
> ----------------------------------------------------------------------
> ---------
> Note: 
> This email (inc all attachments) is for the use of the intended recipient(s) 
> only.
> Privileged or confidential information may be contained in this 
> communication. If you have received this email in error, please notify the 
> sender immediately and then delete all copies of this message from your 
> computer network. If you are not the intended recipient, you must not keep, 
> use, disclose, copy or distribute this email without the author's prior 
> permission. If you are the intended recipient and you do not wish to receive 
> similar electronic messages from us in future, then please respond to the 
> sender to this effect. 
> We have taken precautions to minimise the risk of transmitting software 
> viruses, but advise you to carry out your own virus checks on this email and 
> its attachments. We do not accept liability for any loss or damage caused by 
> software viruses and do not represent that this transmission is free from 
> viruses or other defects. 
> Firstmac Limited (ABN 59 094 145 963) (AFSL 290600)
>  
> ----------------------------------------------------------------------
> --------- _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>   

--
------------------------------------------------------------------------
Jeff Schasny - Denver, Co, USA
jschasny at gmail dot com
------------------------------------------------------------------------
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 -------------------------------------------------------------------------------
Note: 
This email (inc all attachments) is for the use of the intended recipient(s) 
only.
Privileged or confidential information may be contained in this communication. 
If you have received this email in error, please notify the sender immediately 
and then delete all copies of this message from your computer network. If you 
are not the intended recipient, you must not keep, use, disclose, copy or 
distribute this email without the author's prior permission. If you are the 
intended recipient and you do not wish to receive similar electronic messages 
from us in future, then please respond to the sender to this effect. 
We have taken precautions to minimise the risk of transmitting software 
viruses, but advise you to carry out your own virus checks on this email and 
its attachments. We do not accept liability for any loss or damage caused by 
software viruses and do not represent that this transmission is free from 
viruses or other defects. 
Firstmac Limited (ABN 59 094 145 963) (AFSL 290600) 
 -------------------------------------------------------------------------------
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to