Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Aggregate rows to multiple XML-Elements with the same name

Hello!
I guess the subject of this thread is hard to understand, but because english is not my native language my question may be a little hard to explain. I'll try anyway!
Talend Open Studio is the subject of a paper I write for my university. For this purpose I review TOS and write about it's possibilities.
At this point I am quite impressed of the functionality. I especially like the huge amount of available components and that you can make your own relative easily. But let's come to the subject of this thread.
Maybe it's easier when I just show you want I would like to accomplish. Let's say we have this XML-document (in fact, this is a part of the actual document I want to process):
<items>
<item>
<title>Square Enix kündigt Final Fantasy XIII: Epsiode Zero an</title>
<category>Multi</category>
</item>
<item>
<title>Probefassung zu Katamari Forever ein voller Erfolg</title>
<category>PlayStation 3</category>
</item>
<item>
<title>Rock Band: Die Download-Songs der aktuellen Woche</title>
<category>Xbox 360</category>
</item>
<item>
<title>Activision verschiebt Blur auf das kommende Jahr</title>
<category>Multi</category>
</item>
<item>
<title>Fortress: GRINs Final Fantasy befindet sich weiter in Arbeit</title>
<category>Multi</category>
</item>
<item>
<title>PSPgo: Downloads aus dem Ausland ohne weiteres möglich</title>
<category>PlayStation 3</category>
</item>
<item>
<title>Deal of the Week: Flippern zum Sparpreis</title>
<category>Xbox 360</category>
</item>
</items>

What I now want to do is to group the entries by the "category"-element to get this result:
<items>
<item category="Multi">
<title>Square Enix kündigt Final Fantasy XIII: Epsiode Zero an</title>
<title>Activision verschiebt Blur auf das kommende Jahr</title>
<title>Fortress: GRINs Final Fantasy befindet sich weiter in Arbeit</title>
</item>
<item category="PlayStation 3">
<title>Probefassung zu Katamari Forever ein voller Erfolg</title>
<title>PSPgo: Downloads aus dem Ausland ohne weiteres möglich</title>
</item>
<item category="Xbox 360">
<title>Rock Band: Die Download-Songs der aktuellen Woche</title>
<title>Deal of the Week: Flippern zum Sparpreis</title>
</item>
</items>

Is this possible with TOS without writing a custom component? I already tried to use tAggregateRow, but then I don't know what to do with the "title"-element. The aggregate function "list" just concatenates the titles with a comma, while "list(object)" obviously just creates a List-object. In both cases I don't know how to write the XML-document like in the example above. I tried it with tAdvancedFileOutputXML, but this doesn't let me write a "list" of entries in the desired way.
I think it would by a great improvement if this component would be able to process a "List" (object) by just writing one XML-element for each list-entry. Then in my schema a "category" would be a "String" and "title" would by a "List". It would be great if tAdvancedFileOutputXML would process a "List"-type by writing its elements like in the second example above.
While this seems not to be possible at the moment, is there another way to get the desired output?
Thanks in advance!
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

It's always the same: First you try to figure out something by yourself for several days without success. Then you ask in a forum, and short time afterwards you figure it out by yourself. How embarrassing.
I didn't know there was something like a "group element" when you define a XML-tree. After I found this it was easy to figure out that the input has to be sorted.
So just for the other people with similar problems:

The input rows have to be sorted by "category" in this example.
Then defining the XML Tree in tAdvancedFileOutputXML:

This produces exactly the output I wanted.
I am sorry for asking too quickly.

View solution in original post

3 Replies
Anonymous
Not applicable
Author

It's always the same: First you try to figure out something by yourself for several days without success. Then you ask in a forum, and short time afterwards you figure it out by yourself. How embarrassing.
I didn't know there was something like a "group element" when you define a XML-tree. After I found this it was easy to figure out that the input has to be sorted.
So just for the other people with similar problems:

The input rows have to be sorted by "category" in this example.
Then defining the XML Tree in tAdvancedFileOutputXML:

This produces exactly the output I wanted.
I am sorry for asking too quickly.
Anonymous
Not applicable
Author

Hello guy
Good news! I just want to tell you to use 'group element' feature.
Best regards

shong
Anonymous
Not applicable
Author

I will write good things about the support in my paper 0683p000009MACn.png