on 05-24-2013 2:47 PM
Hi Experts,
I have a scenario , where the record needs to be inserted in Multiple rows, I searched in scn and following some blogs, but still no luck.
Below is the input structure:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_TGTDB_0 xmlns:ns0="http://multiplerow">
<tbldummy_PI_test>
<row>
<MemberID>M1</MemberID>
<MemberName>Baskar</MemberName>
<Premium>
<PremiumID>Pi</PremiumID>
<PremiumName>Siva</PremiumName>
</Premium>
</row>
</tbldummy_PI_test>
</ns0:MT_TGTDB_0>
I want the data to be inserted multiple rows in table as below
M1 | Baskar
P1 | Siva
But right now , only 1 row inserted.
M1 | Baskar
Note: i have duplicated "access" and mapped to PremiumId & PremiumName , but it seems PI is not accepting access1.
Attachment has the configurations done.
MessageMapping Definition: MM_Definition.PNG
MessageMapping Test:MM_Test.PNG
Communication channel monitoring: CC.PNG
Thanks in advance,
Baskar
Baskar,
Why you have given name for second record as access1? that is wrong change it to access.
If you wanna update multiple records in same table then you have to generate access tag twice using mapping.map root node of row to access .
Thank you,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks all for all your support to fix this issue.
Baskar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Baskar,
You need to do an intermediate mapping to arrive at an intermediate structure like below:
So your interface will have 2 graphical mappings instead of 1. In the first mapping, you will populate your intermediate structure with the outcome as below:
<row>
<MemberID>M1</MemberID>
<MemberName>Baskar</MemberName>
</row>
<row>
<MemberID>Pi</MemberID>
<MemberName>Siva</MemberName>
</row>
this will be dependent on the source structure and Occurance of nodes row, Premium.If you can send that, I can help further.
In the second mapping you populate the JDBC structure.
Then you can map the row (with remove context) to the Statements node in the target; access can be mapped to a constant while the fields can be mapped one to one.
Then you will surely be able to populate the target JDBC structure with 2 records as desired.
Hope it helps!
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Baskar,
Here is how you do the first mapping. It turned out to be very simple.
You map row in source to First Row in the target. Duplicated Row is mapped to Premium.
rest fields are mapped one to one.
I tested it with following test case:
It works...
Now you map the intermediate structure in next mapping to JDBC structure like I suggested.
Map row(removeContext to Statements.
access to be mapped to constant.
rest fields one to one.
check in database
Hope it helps!
Ambrish
Updated with a better screenshot of first mapping Message was edited by: Ambrish Mishra
Hi Baskar,
My bad!
I did not look at the source message type clearly. let me figure out a solution and revert back.
Ambrish
PS: I have deleted my posts so that others are not confused but the solution will be on same line.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Baskar,
you can go ahead two statements parallel execution. so create 2 statements indivually in one message and update with different row.
second option is give pass sql query directly and execute.
Regards,
Loordh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.