on 10-12-2007 3:10 AM
I have one source field: EMPDETAILS.
this field is getting the below data
-
<ProcessEmployeeChangeResponse xmlns="http://www.bl.edu/">
<EMPDETAILS><?xml version="1.0" encoding="utf-8" standalone="no"?>
<Employee PersonnelNumber="98432" FirstName="Robert" MiddleName="Dix" LastName="Bob" Department="00000014" Group="" EffectiveDate="12/17/2001 9:30:47 AM" Action="Z1" SapUserID="10rbob" EmailAddress="rbob@bl.edu" DefaultPassword="*" Status="Success" /></EMPDETAILS>
</ProcessEmployeeChangeResponse>
</soap:Body>
</soap:Envelope>
-
i want to write a User defined function (UDF) using JAVA to extract the EmailAddress to assign th target field "CommunicationID" (this is the target field)
Can any can help me to write Java userdefined function for this purpose.
Thanks
Dhanus
Hi Dhanush,
i am giving UDF code to extract email id:rbob@bl.edu /
i assumed that always you will get email id in this string format <b>EmailAddress="[ID]"SPACE</b>.
value within <b>[]</b> can change.
This is <b>Value</b> UDF.
int st_index = a.indexOf("EmailAddress=");
int ind_space = a.indexOf(" ",st_index);
String str = a.substring(st_index("EmailAddress=".length())1,ind_space-1);
return str;
Here <b>a</b> is input field from source message.
Please let me know if you have any issues with this UDF.
Cheers,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jag,
thank you very much for your help. the provided java code is working for both EmailAddress and MiddleName ( there is no pace in between EmailAdress). when i try to use same code for extracing "Employee PersonnelNumber" as this has space between Employee and PersonnelNumber, so it is giving me java error, can you please modify given java code accordingly, Please do me this favoure i am grateful to u as i am not good in writing java functions.
thanks
Dhanush.
Hi Dhanush,
i am giving reusable UDF code that means you can use this code to extract any field value from your source messages.
i am sure this code serves all needs.
//write your code here
int st_index = a.indexOf(b);
int ind_space = a.indexOf("\"",st_index + b.length()+1);
String str = a.substring(st_index(b.length())1,ind_space);
return str;
<b>Note:-</b> a,b are input fields
Here <b>a</b> is source field from source message type
<b>b</b> is constant value i.e if you want to extract <b>EmailAddress</b> from source message constant value should be <b>EmailAddress=</b> or
To extract <b>Employee PersonnelNumber</b> just give constant value as <b>Employee PersonnelNumber=</b>
Please let me know if you want further details about this UDF.
Cheers,
Jag
Hi
can you please provide your source structure and the target structure.
for this, in the graphical mapping map the source field (that contains the email id )
with the target field communication ID.
if still face the problem please reply me back
Thanks
Rinku
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey dhanush,
Can you provide both the source and target structure ??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.