on 08-01-2014 5:00 PM
Hello Experts,
Can someone help me in this mapping :
Source XML :
<Root>
<Person>
<PersonNumber>1234</PersonNumber>
- <Details>
<Country>XXX</Name>
</Details>
</Person>
<Person>
<PersonNumber>1234</PersonNumber>
- <Details>
<Country>YYY</Country>
</Details>
</Person>
<Person>
<PersonNumber>4321</PersonNumber>
- <Details>
<Country>ZZZ</Country>
</Details>
</Person>
</Root>
Target XML :
<Root>
<Person>
<PersonNumber>1234</PersonNumber>
- <Details>
<Country>XXX</Name>
</Details>
- <Details>
<Country>YYY</Country>
</Details>
</Person>
<Person>
<PersonNumber>4321</PersonNumber>
- <Details>
<Country>ZZZ</Country>
</Details>
</Person>
</Root>
The requirement is if the PersonNumber is same for any two occurence then we have to create only one Person node with the </Details> collated.
Rest all data will be passed as it is.
We have to do it only for a maximum of two occurences i.e. one person number can occur for a maximum of two times.
We want to achieve thsi using Graphical maaping.
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gaurav,
Please try the following Mapping with some changes:
Use the same Mapping for Details Node as used for PersonNumber and Person
Take the input after SplitByValue[ValueChange] from Above and use it as shown below:
[Input1 for FormatbyExample]SplitByValue[ValueChange]--->
FormatbyExample ---> Country
[Input2 for FormatbyExample]Country---->RemoveContext---->
Hope this Helps,
Thanks & Regards,
Tejas Bisen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Gerald/Tejas ,
This mapping works fine when there is only one detail record per employee. IF the detail record repeat itself then it fails.
I want AAA BBB and DDD to come under number 1234.
CCC under 4321.
Format by Example will also not work as there is difference in the number of queue entries for Person number and Detail records.
Thanks
Hi Gaurav,
Following is my Solution to your Problem:
This Mapping will work irrespective of the order of the Personno.
P.S: Make Country Context and PersonNo Context for UseoneasMany Function as Person.
Following is the screenshot of the Test I performed:
I finally got hold of a System as your issue wasn't getting resolved
Hope This helps.
Thanks & Regards,
Tejas Bisen
Thanks for your time Tejas ,
Its very close, just the Detail node should get repeated on target side instead of country...
So i should see 3 details node created under person 1234 with one country each.
In short the requirement is to combine the details node if the person number is same.
Any chance that can be achieved?
This should happen irrespective of the order of Person number.
I.e. input can be 1234 4321 1234
Thanks
Hi Gaurav,
this would be my solution, which is similar to what the other guys were saying.
Move context of source field PersonNumber up one level to <root> and apply the following mapping
to Person and PersonNumber
You need to apply the same logic to details as well:
A somewhat overdesigned mapping would be:
The marked part alone would also do the job
Or if you want the whole mapping grouped in one:
Cheers
Gerald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Gerald ,
This does solves my first issue.
One more requirement is the country field can repeat itself. I am doing this test as part of a big requirment.
I want values AAA & BBB also to be printed in the details node of Person number 4321.
I have tried using SortBYkey in combination with PersonNo. but that will not work as two queues are having different number of values.
Any ideas on how to solve this?
Thanks.
Hi Gaurav,
In the Target, make your Country Field as 0... Unbounded and maybe your next requirement will get covered.
You can use FormatbYExample to arrange the queue for Country for Target.
For this you will need to take the output of Person right after SplitbyValue(which is being given to PersonNO.) but before collapsecontext as an input to FormatByexample.
Thanks & Regards,
Tejas Bisen
Hi Tejas
Yes i got that...but if the detail node is repeating as per screenshot above then how can we collate all the detail nodes of a particular emplyee i.e. 1234 in one single person node??
Twomore detail nodes having bbb & xxx value ofcountry shd get created and ggg should be passed to detail node of 4321.
Thanks
Hi Gaurav,
Souvik's approach will surely work.
Adding to his approach. Map the PersonNumber Field to Detail of Target. This will create the correct no. of Detail nodes required for populating the country field.
Thanks & Regards,
Tejas Bisen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Tejas/Souvik ,
This does not solve my issue. Collapse contexts is only takin gthe one employee 1234 and is skipping 4321 employee number.
Also the target XML is not generating correctly.
Person node is also repatign three times however it should only occure twice.
Output as per your approach :
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_TRGT xmlns:ns0=">
<Root>
<Person>
<PersonNo>1234</PersonNo>
<Details>
<Country>XXX</Country>
</Details>
</Person>
<Person>
<Details>
<Country>YYY</Country>
</Details>
</Person>
<Person>
<Details>
<Country>ZZZ</Country>
</Details>
</Person>
</Root>
</ns0:MT_TRGT>
Thanks
Hello Tejas ,
Still near around same output , but not the one i want.
<Root>
<Person>
<PersonNo>1234</PersonNo>
<Details>
<Country>XXX</Country>
</Details>
</Person>
<Person>
<Details>
<Country>YYY</Country>
</Details>
</Person>
<Person>
<Details>
<Country>ZZZ</Country>
</Details>
</Person>
</Root>
Thanks
Hi Gaurav,
You can map the field PersonNumber to "Split By Value Changed" function, this in turn can be mapped to "Remove Context" function, which then should be mapped to "Collapse Context" function, and finally it being mapped to the target field "PersonNumber".
Explanation for the above : "Split By Value Changed" will split depending upon the change in value. "Remove Context" will group all those same values under one context. Finally, "Collapse Context" will choose the first element from each of those resulting context.
Regards,
Souvik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.