Subject:Loops Author:Jolene Meyer Date:13 Feb 2009 12:26 PM
I have an xquery program complete and now the "to" source is telling me I can only have 1 purchase order per ESB. Is there an easy way to change my program so I don't have to start over. I am attaching my files. So i guess I would need one esb segment for every purchase order header. Is that even possible with how I have it written.
Subject:Loops Author:Minollo I. Date:13 Feb 2009 12:53 PM
I'm not positive I understand what you need to do; if you need to create one whole <esb:Body> for each purchase order described in the source, you can just change:
...
<esb:Body>
{
for $Order in doc('converter:file:///c:/aaaa/storefront_send.conv?file:///c:/aaaa/zzedi856_o.dat')/root/Order
return
...
into
...
for $Order in doc('converter:file:///c:/aaaa/storefront_send.conv?file:///c:/aaaa/zzedi856_o.dat')/root/Order
return
<esb:Body>
...
If you need to create a completely separate <esb:Envelope> for each purchase order, then you will need to create multiple output files; but before suggesting you how to do that, I would like to be sure that's what you need.
Subject:Loops Author:Jolene Meyer Date:13 Feb 2009 03:48 PM
I do need to create your 2nd option
.
.
.
If you need to create a completely separate <esb:Envelope> for each purchase order, then you will need to create multiple output files; but before suggesting you how to do that, I would like to be sure that's what you need.
Subject:Loops Author:Minollo I. Date:13 Feb 2009 04:05 PM
Then you need to bring the loop at top level; and you have two choices: you either serialize the result as part of the XQuery, or you do that in your Java code executing the XQuery (and serializing each top item in the result sequence).
Doing that in the XQuery is very simple, but it forces you to materialize the results as URLs; you can of course tweak the output file name as you like. Attached.