on 10-12-2006 11:20 AM
Hi Prakash,
In continuation to our conversation yesterday in regards to message mapping, I tried the solution you provided but when i test the mapping in gives a error.
Mapping scenario:
Source Target
Name >>> Name1
First >>> First1
Last >>> Last1
Address >>> Address1
Now is it possible that if I don't pass any value to a particular element say 'Last' in source then 'Last1' should not be present in the resulted mapping. I.e the result of the mapping should have only Name1, First1 and Address1. and if 'Last' is passed some value then all the four should appear in the result.
Solution you adviced is:
First make sure the ocurance of the Last1 is 0..1
Last
\
Equals>Not>IfWithoutElse -->Last1
/ /
Constant("") Last (then)
The issue is how do i represent empty or null in constant box.
If i represent it as "" or " " or NUll i get a error when i test the mapping.
Regards,
Ashish
Hi Prakash,
After applying the new mapping i am still getting the same error:
RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:Message2/E. The message is: Exception:[java.lang.IllegalArgumentException: Cannot cast to boolean] in class com.sap.aii.mappingtool.flib3.Bool method equals[, "", com.sap.aii.mappingtool.tf3.rt.Context@264c60]
the error is generated at the first equals step. Probably because Last is string and Constant "" is of some other data type.
Also in my scenario I have hundred elements that i need to apply this mapping. If i go with the UDF mapping, then is there a way to copy this mapping and apply it to other elements at one go.
Regards,
Ashish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashish,
Are you sure you tried the same what I have given there above. <b>1st Equals</b> is string equals which you will find under the section <b>Text</b>. <b>2nd Equals</b> is boolean equals which you will find under the section <b>Boolean</b>.
If you want to do it for many fields then better to go for UDF. But its ultemately left to your comfort, but for copying I can give you some idea try this...
1. Right click you mouse on last function in your mapping (In your case it is IFWithoutElse) and select <b>Copy</b> from the menu. Then double click the next node in the target to be mapped and it will appear in the editor. Now right click the mouse and <b>Paste</b> it. Now you can see all the functions starting from the benining to the IFWithoutElse function will be pasted. Now you will have Last node as source, just delete it and map with the otehr source node. Give the output of IFWithoutElse to the Target node.
2. You can Export the mapping by CtrlShiftRight click select Export. You will be able to export the mapping that you have done. Now you can edit that file snd see what is the pattern and copy paste for the nodes you need. Then import the same.
Thanks,
Prakash
Dear Ashish,
This is my Guess try taking away the quotes.
Page 67 will help you
Regards
Agasthuri Doss
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The above solution would work if you have Last node in the source with a Empty value.
If you would like to check both that is "" and NULL as well you can always go for a UDF
if (a.equals(null) || a.equals(""))
return false;
else
return true;
Assuming <b>a</b> is the paramter while defining the UDF
Last-->UDF-->IFWithOutElse-->Last1
/
Last
Thanks,
Prakash
Hi guys,
I just want that when no value is passed to last, then last1 should not appear in the result. But how do i represent nothing or empty in constant box. Is it NULL, or "", because if i use NULL or "" both of them generate error.
when i keep the constant value empty, i get the error below. Same for "", NULL and " ".
"RuntimeException in Message-Mapping transformation: Exception:[java.lang.IllegalArgumentException: Cannot cast to boolean] in class com.sap.aii.mappingtool.flib3.Bool method equals[, , com.sap.aii.mappingtool.tf3.rt.Context@c6ac36]"
Regards,
Ashish
Hi prakash,
I created a UDF with no import parameter and one argument 'a' of string type and following code:
if (a.equals(null) || a.equals(""))
return false;
else
return true;
I get the error when i test the mapping:
Source code has syntax error: D:/usr/sap/X7A/DVEBMGS09/j2ee/cluster/server0/./temp/classpath_resolver/Map2bd71e3259e611dba361000f206d294f/source/com/sap/xi/tf/_Mapp_.java:59: <b>incompatible types found : boolean required: java.lang.String return false;</b> ^ D:/usr/sap/X7A/DVEBMGS09/j2ee/cluster/server0/./temp/classpath_resolver/Map2bd71e3259e611dba361000f206d294f/source/com/sap/xi/tf/_Mapp_.java:61: <b>incompatible types found : boolean required: java.lang.String return true;</b> ^ 2 errors
Regards,
Ashish
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.