IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Nested Loops Options · View
tuanvoooooo1
Posted: Wednesday, July 4, 2018 11:31:50 AM
Rank: Member

Joined: 6/29/2018
Posts: 11
I'm going to make a case that demonstrates what I want to achieve.

I have three people James, Carl and George.
Each of these people have pets.

James => cat, mouse
Carl => goldfish
George => Kangaroo, Chimpanze, Iguana

I want to make a three page PDF that display the person and the pets that he owns on each page.

Page 1:

Name: James

Pets: Cat, mouse

Page 2:

Name: Carl

... and so on

Suppose that the XML look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<DOCUMENT>
<DATA>
<ROWSET1>
<ROWSET1_ROW>
<PERSON_ID>1</PERSON_ID>
<PERSON_NAME>James</PERSON_NAME>
</ROWSET1_ROW>
<ROWSET1_ROW>
<PERSON_ID>2</PERSON_ID>
<PERSON_NAME>Carl</PERSON_NAME>
</ROWSET1_ROW>
<ROWSET1_ROW>
<PERSON_ID>3</PERSON_ID>
<PERSON_NAME>George</PERSON_NAME>
</ROWSET1_ROW>
</ROWSET1>
<ROWSET2>
<ROWSET2_ROW>
<PET_ID>1</PET_ID>
<PERSON_ID>1</PERSON_ID>
<ANIMAL>Cat</ANIMAL>
</ROWSET2_ROW>
<ROWSET2_ROW>
<PET_ID>2</PET_ID>
<PERSON_ID>1</PERSON_ID>
<ANIMAL>Mouse</ANIMAL>
</ROWSET2_ROW>
<ROWSET2_ROW>
<PET_ID>3</PET_ID>
<PERSON_ID>2</PERSON_ID>
<ANIMAL>Goldfish</ANIMAL>
</ROWSET2_ROW>
<ROWSET2_ROW>
<PET_ID>4</PET_ID>
<PERSON_ID>3</PERSON_ID>
<ANIMAL>Kangaroo</ANIMAL>
</ROWSET2_ROW>
<ROWSET2_ROW>
<PET_ID>5</PET_ID>
<PERSON_ID>2</PERSON_ID>
<ANIMAL>Chimpanze</ANIMAL>
</ROWSET2_ROW>
<ROWSET2_ROW>
<PET_ID>6</PET_ID>
<PERSON_ID>2</PERSON_ID>
<ANIMAL>Iguana</ANIMAL>
</ROWSET2_ROW>
</ROWSET2>
</DATA>
</DOCUMENT>

I'm kind of stuck on this problem, so thanks in advance to any one that respond :)
K101
Posted: Wednesday, July 4, 2018 11:49:15 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 565
That's easy enough using a variable, set on the current ROWSET1_ROW item holding its' PERSON_ID value, to match the records from ROWSET2 against the current record from ROWSET1. See the attached example.

File Attachment(s):
example.pxf (71kb) downloaded 358 time(s).


tuanvoooooo1
Posted: Wednesday, July 4, 2018 1:19:57 PM
Rank: Member

Joined: 6/29/2018
Posts: 11
it worked! thanks :)
tuanvoooooo1
Posted: Monday, July 9, 2018 8:13:05 AM
Rank: Member

Joined: 6/29/2018
Posts: 11
I got a followup question on this topic.
Consider the same case as mentioned above, but now each person want to have a unique image representing the animals attached to their page as well. (ea Carl wants a picture of his goldfish on his page, John want a group picture of the Kagaroo, Chimpanze and Iguana etc... point is only one picture per persona page)
How do i implement that?
The images are stored locally.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.