on 12-02-2011 10:08 AM
Hi ,
I have scenario, where in mapping I need to have a condition.. where the fields are not mandatory.
Below is the my Source XML:
<?xml version="1.0" encoding="UTF-8" ?>
<INVENTORYINTERFACE>
<DOCUMENT>
<SAPFUNCTIONALITY>CONSUMPTION</SAPFUNCTIONALITY>
<BLDAT>07.29.2011</BLDAT>
<BUDAT>07.29.2011</BUDAT>
<FileName>test.xml</FileName>
<MATERIALDATA>
<MATNR>1000000000</MATNR>
<BATCHDATA>
<CHARG>123456789</CHARG>
<WERKS>1000</WERKS>
<ERFMG>186.10</ERFMG>
<ERFME>KG</ERFME>
<ID>1</ID>
<FLAG>Y</FLAG>
</BATCHDATA>
</MATERIALDATA>
</DOCUMENT>
</INVENTORYINTERFACE>
Here if ID or Flag is not there then I need to process.
And If ID exists then I need to check for the Flagexistsa or not... if any of then is missing then I need to fail the mapping
How can I do so?
Hi Hareen,
id -> exits(true) -> constant(true) -> equals ->if (then)-> check -> exits -> constant(true) -> equals -> target msg
thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
first u dont write ur logic ,
u try this
1.id -> 2.exits(true) -> 3.constant(true) -> 4.equals ->5.(first)if (then)
-> 6.check -> 7.exits -> 8.constant(true) -> 9. equals -> 10.(second)if -> target
if Check fail (second)(if) then -> constant -> target msg
if Id fail (first )if-else ->constant -> target
thanks,
Resolved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If both ID and flag exists then only map your target message type.
ID> exists->IF-true>check Flag>Exists>IFtrue-->map target message whose occurrence is 1.
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Priyanka / Ramesh,
I have 3 different conditions in my mapping.
1. If ID and Flag does not exist then I should be able to map to the target fields without those fields.
2. If ID and flag exists then I should be able to process the messages with having those fields in the target.
3. If any of the ID and Flag field is missing in the source then I need to fail the mapping.
Hi,
1. If ID and Flag does not exist then I should be able to map to the target fields without those fields.
2. If ID and flag exists then I should be able to process the messages with having those fields in the target.
3. If any of the ID and Flag field is missing in the source then I need to fail the mapping.
>>>
You write the condition for 1 and 2 one. For third one you dont need any check because you are checking for 2 possibilites out of 3.
IF (ID exists) and IF (FL exists)
OR -
> Create Target Node
IF (ID not exisit) and IF (FL not exists)
regards
Ramesh
Edited by: Ramesh P on Dec 2, 2011 4:11 PM
Hi,
It means you've perform XOR operation..... you can try with below UDF...use java XOR operator (^).
Fist use exists function for ID and flag and pass it as inputs to UDF and map the UDF to target messagetype
UDFCode:
int var1,var2;
if(input1.equals("true"))
var1 = 1;
else
var1 = 0;
if(input2.equals("true"))
var2 = 1;
else
var2 = 0;
int res = var1 ^ var2;
if(res == 1)
return true;
else
return false;
Regards,
Priyanka
Hareen,
Map your required condition to the root of the target message type.
If ID (node function) exists and If flag exists create your root target node!
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.