« October 10, 2007 | Main | October 12, 2007 »

October 11, 2007 Archives

October 11, 2007

Loopin' Trick

An old question and Im not sure why it bubbled to the top of the forum today. Question is from Ruth:


Can anyone help?
I have XML output from the PO Output for Communication report which looks like this

<LINE_ATTACHMENTS>
<TEXT>SLC CUSTOMER REFERENCE=100</TEXT>
<ID>2679</ID>
<TEXT>SLC CUSTOMER REFERENCE=88</TEXT>
<ID>2680</ID>
<TEXT>SLC CUSTOMER REFERENCE=5512</TEXT>
<ID>2681</ID>
</LINE_ATTACHMENTS>

I need to display all three of the text fields but cant seem to find a way to do it. I have tried for-each and if statments but they only show the 1st text field, I cant seem to find away to display the 2nd and 3rd ones.

Can anyone help?


Ruth really really needed help - Im happy to say it was not me answering but one of our active forum members 'vetsrini' - sorry Sir or Marm I can identify you no further from the forum.


You folks need to share your names in your posts or handles - its so much easier to reply to 'John' or even 'Dr Plexi' than User353533 - get a cool handle such as 'The Tick' or maybe 'Sleepless in Seattle' - cheesy maybe, but we know two things about you already - you live 'up t'North' and you're an insomiac who watches mushy flicks with Tom Hanks in it - must be those long rainy nights. Sorry, 'Seattlites' - I have been to Washington about 6 times now and every time it been raining - its always very 'green' in your neck of the woods.


Back to Ruth's issue and 'Vet's' solution  - hope you dont mind I gave you a nickname. Ruth wanted a table showing 'ID' and 'Text' in a two columned table and was a little stuck on how to construct the loop required. Looking at the XML the elements needed are wrapped in the LINE_ATTACHMENTS element but just looping over that:


<?for-each:LINE_ATTACHMENTS?>
<?ID?>       <?TEXT?>
<?end for-each?>


will only give us the first members of the set. You can actually take the looping down a level further ie for-each:LINE_ATTACHMENTS/ID and for-each:LINE_ATTACHMENTS/TEXT and get the looping correct. We now have two loops in their own cells.


FELoop1:


Here's the contents of the fields.


FELoop2:


Notice that we use '.' in the ID and Text fields - this tells the rendering engine 'insert the current element here' ie the TEXT or ID column thats we are looping on. Now we get out like:


FELoop3:


Thanks for the solution 'Vet' and 'Ruth' for the question - keep em coming!

About October 2007

This page contains all entries posted to Oracle BI Publisher Blog in October 2007. They are listed from oldest to newest.

October 10, 2007 is the previous archive.

October 12, 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle