on 02-25-2008 2:49 PM
Hi,
I am doing a scenario in which i have to insert a record into jdbc table based on a field value in source structure.
e.g. i have an xml message with 3 records like below
col 1 col2 col3
A 1 !
B @
C 3 #
now i want to insert a record for A and C but not for B, since for B col2 has no value.
in short i want to skip my mapping in case of B.
Thanks,
Sumit
to do this,
you must define a condicion in Receiver Determination in ID and specify what value shuold come in this field for data passed to receiver system.
in IR, how you are getting data from a DB, you must define a specific structure, see this link
<DT_xxxxx>
..<row>0...unbounded
....<col1>
....<col2>
....<col3>
..</row>
</DT_xxxxx>
the tag <row> indicate that you are receiving data from a SQL query that you execute in this case in you Communication Channel.
Thanks
Rodrigo
Reward Points Please
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sumit,
Which target structure are u using? It can be easily done in mapping. If you could give the source and target structure it could be easy for us to suggest.
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sumit,
If it's 1, then how come in your example you missed one col( I mean one field). It's not possible right? If the occurrence is 1 , then always must present in the source, isn't it? I can suggest you right away the solution, but before I want to confirm with you what u are exactly looking for, that's why I'm asking all these question.
raj.
Edited by: Raj on Feb 25, 2008 9:13 AM
Sumit,
If you are not sure whether the data will come all the times from the source, then change the occurrence to 0..1.Here's the solution.
Go thru the below logic.
The item must be mapped to the Access node of the target.
Results
http://www.flickr.com/photos/23855877@N07/2291840434/sizes/o/
Mapping for Access node
http://www.flickr.com/photos/23855877@N07/2291840440/sizes/o/
Mapping for Fields
http://www.flickr.com/photos/23855877@N07/2291840444/sizes/o/
UDF used for generating Access Node
http://www.flickr.com/photos/23855877@N07/2291840510/sizes/o/
for(int i=0;i<input1.length;i++)
{
if(!(input1<i>.equals("No Value") || input2<i>.equals("No Value")))
result.addValue("");
}
UDF used for generating fields
http://www.flickr.com/photos/23855877@N07/2291840512/sizes/o/
for(int i=0;i<input1.length;i++)
{
if(!(input1<i>.equals("No Value") || input2<i>.equals("No Value")))
{
if(field[0].equals("1"))
{
result.addValue(""+input1<i>+"");
result.addContextChange();
}
else if (field[0].equals("2"))
{
result.addValue(""+input2<i>+"");
result.addContextChange();
}
}
}
Hope it helps!
raj.
hi
excuse me the previous post, i was wrong with JDBC structure.
for structures see this.
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
about you questions, yes is possible to check if there is a value in a field or if the field exist in the receiver structure. you must put it in receiver determination--> condicion
for example:
/p1:MT_sp_demo/row/REG256 = EX --> here you check if the field REG256 exist in XML structure
(/p1:MT_sp_demo/row/REG256 ≠ )here verify if the fiel have any value
also here you can use Xpath function (substring,lenght,ect)
Thanks
Rodrigo
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.