Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone !
Here is a test job :
And the tFixedFlowInput configuration :
The tXML_Map configuration :
I get this XML string :
<?xml version="1.0" encoding="UTF-8"?> <students> <student> <name>A</name> <stat>15</stat> </student> <student> <name>B</name> <stat>13</stat> </student> <student> <name>A</name> <stat>13</stat> </student> <student> <name>A</name> <stat>17</stat> </student> <student> <name>B</name> <stat>14</stat> </student> <student> <name>C</name> <stat>12</stat> </student> </students>
I wonder if it's possible to "aggregate" values and get rather this XML string :
<?xml version="1.0" encoding="UTF-8"?> <students> <student> <name>A</name> <stat>15</stat> <stat>13</stat> <stat>17</stat> </student> <student> <name>B</name> <stat>13</stat> <stat>14</stat> </student> <student> <name>C</name> <stat>12</stat> </student> </students>
This structure would be kind of difficult to read because here a student could have an infinity of stats, I'm aware of that, BUT, just by curiosity, I would like to know if it's possible to generate XML like this ?
Thanks !
Using tSortRow + student as group + stat as loop I get this :
<?xml version="1.0" encoding="UTF-8"?> <students> <student> <name>A</name> <stat>13</stat> <stat>15</stat> <stat>17</stat> </student> <student> <name>B</name> <stat>13</stat> <stat>14</stat> </student> <student> <name>C</name> <stat>12</stat> </student> </students>
That's nice !
It's clear that the work would be more difficult if there are sub elements in stat, with loops...
Thank you for your help !
I think that
Could you try adding in the tXMLMap (out1) the loop to the stat tag instead of the student tag? I didnt tested it so im not sure if this will work in your case.
Hello,
give a try to this : put an aggregate on name and loop on stat
Thanks and regards
tjclearner
Hello,
When I only set stat as loop I get :
<?xml version="1.0" encoding="UTF-8"?> <students> <student> <name>A</name> <stat>15</stat> <stat>13</stat> <stat>13</stat> <stat>17</stat> <stat>14</stat> <stat>12</stat> </student> </students>
I couldn't create a group on name so I tried to create a loop on stat and then a group on student.
I get this XML file :
<?xml version="1.0" encoding="UTF-8"?> <students> <student> <name>A</name> <stat>15</stat> </student> <student> <name>B</name> <stat>13</stat> </student> <student> <name>A</name> <stat>13</stat> <stat>17</stat> </student> <student> <name>B</name> <stat>14</stat> </student> <student> <name>C</name> <stat>12</stat> </student> </students>
Almost ! 😕
hello,
why not use first a tsortrow then :
put an aggregate on name
and loop on stat
Thanks
Try setting up the "All in one" option as true and run the job again. This with my example because if you are using aggregate you have to set it as false (check this aswell).
Using tSortRow + student as group + stat as loop I get this :
<?xml version="1.0" encoding="UTF-8"?> <students> <student> <name>A</name> <stat>13</stat> <stat>15</stat> <stat>17</stat> </student> <student> <name>B</name> <stat>13</stat> <stat>14</stat> </student> <student> <name>C</name> <stat>12</stat> </student> </students>
That's nice !
It's clear that the work would be more difficult if there are sub elements in stat, with loops...
Thank you for your help !
I think that