cancel
Showing results for 
Search instead for 
Did you mean: 

Complex mapping question (aggregate)

jean-philippe_pain2
Participant
0 Kudos

Hello all,

For example, i have a xml structure in input :

<XML Input Structure>

<Line1>

<Country> Fr </country>

<Currency> EUR <Currency>

<Town> Paris </Town>

<MT> 10 </MT>

</Line1>

<Line2>

<Country> Fr </country>

<Currency> EUR <Currency>

<Town> Paris </Town>

<MT> 10 </MT>

</Line2>

<Line3>

<Country> USA</country>

<Currency> DOL <Currency>

<Town> Chicago </Town>

<MT> 20 </MT>

</Line3>

<Line4>

<Country> USA</country>

<Currency> DOL <Currency>

<Town> Detroit </Town>

<MT> 20</MT>

</Line4>

</XML Input Structure>

In output, i want to aggregate the field "MT" only when fields "Country, Currency and Town" are the same in order to have something like that :

<XML Output Structure>

<Line1>

<Country> Fr </country>

<Currency> EUR <Currency>

<Town> Paris </Town>

<MT> 20 </MT>

</Line1>

<Line2>

<Country> USA</country>

<Currency> DOL <Currency>

<Town> Chicago </Town>

<MT> 20 </MT>

</Line2>

<Line3>

<Country> USA</country>

<Currency> DOL <Currency>

<Town> Detroit </Town>

<MT> 20 </MT>

</Line3>

</XML Output Structure>

I am not a specialist in java so i would like to knowi if it's possible to do it with node standard functions ? if not, what is the best solution : XSLT, Java mapping, UDF ?

Thanks by advance,

JP

Edited by: Jean-Philippe PAIN on Dec 16, 2008 12:14 PM

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

with standard it would be pretty hard

but with a simple UDF (with 4 inputs) you can aggregate

and output it quite easily

try with a udf if you don't want to go for java mapping

Regards,

Michal Krawczyk

http://mypigenie.com XI/PI FAQ

jean-philippe_pain2
Participant
0 Kudos

Ok, thanks.

Answers (0)