on 07-04-2006 9:23 AM
Hi,
In my scenario i need to build a UDF for the next structure:
<b>http://www.directupload.net/show/d/748/Di5MbK3H.jpg</b>
<b>source</b>
<Record>
<KEY>"Firstname"</KEY>
<TEXT>Michael</TEXT>
<KEY>"Lastname"</KEY>
<TEXT>Jordan</TEXT>
<KEY>"Organisation"</KEY>
<TEXT>chicagobulls</TEXT>
</Record>
<b>Target</b>
<Customer>
<Firstname>Michael</Firstname>
<Lastname>Jordan</Lastname>
<Organisation>chicagobulls</Organisation>
</Customer>
<b>http://www.directupload.net/show/d/748/kc68N5xL.jpg</b>
Can anyone provide me any help regarding the constrution of UDF, as i'm not an expert in java code ...
Thanks in advance,
Fth
Why do you want to use a UDF? You are doing well with your if construction.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<b>Hello Stefan,Vijaya,Ananth</b>
I tried this first only for "Firstname"and they was Successfuly (if i disable fields "Lastname" and "Organisation").
But if i reply for "Lastname" and "Organisation" then give me an error.
<b>Cannot produce target element /ns0:MT_TARGET/Customer/Firstname. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd</b>
(stefan)Hope this clears yours doubt
regards,
Fth
Hello stefan,
it's worked if i send the all field values.
<b>http://www.directupload.net/show/d/748/o34Ok8jZ.jpg</b>
but not only <b>Firstname</b> and <b>Lastname</b> why?
http://www.directupload.net/show/d/748/szqOVLC5.jpg
Regards,
Fth
Hi Fatih,
As everyone said, it is not necessary to use UDFs here, instead you can use the Graphical mapping itslef. Also what you have done is good.
Since you have asked for it, here the code for UDF...
String input = "Firstname";
if(a.equals(input))
return b;
else
return "";
Just create a UDF with two arguments, first one is for the key field and the next one is for text field.
This is a simple UDF. U can also perform this in many ways. U need to create 3 UDFs by changing the input value as "Lastname" and "Organisation".
Hope this helps..
Regards,
Prasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fatih,
For your requirement you dont have to use UDF instead you can desing your mapping like this
<b>
Key ------ Equlas ("Firstname") ------- | IF without Else |-----> Firstname (Target)
Text -------------------------------------------------| |
Key ------ Equlas ("Lastname") ------- | IF without Else |-----> Lastname(Target)
Text -------------------------------------------------| |
Key ------ Equlas ("Organisation") -------| IF without Else |-----> Organisation(Target)
Text -------------------------------------------------| |
</b>
Here I am assuming your Source structure definition is like this:
<b>
Record
Key --- 0-UB
Text--- 0-UB
</b>
Regards,
Ananth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
As my understanding to your query you want to check if the <key> value is Firstname then put the <text> into <frstname>
You can try this
<KEY>--><equalsS>
<constant-fistname> --> <ifwithoutelse> <text> --> <Firstname>
So you are going to check first whether content of <key> is 'firstname' using 'equalsS' function in TEXT and hten if the reply is true then you mapt he value to <firstname>
Do the same for other receivers also.
Regards
Vijaya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.