on 03-18-2008 4:07 AM
Hi all,
I need to create a message mapping where two output messages are involved. I need to map the input to one of the output messages based on the value of one of the parameters. How to create a user defind functionfor the same.
Input structure: name , age
Output 1 : name, age
Output 2 : name, age, status
Here status has to be "Elgible" if age is above 18 else "not eligible".
Can any one please provide me with the details like what kind of UDF it should be, Simple or Advanced ? How many input parameters? and the jave code to be written in UDF? also how to map this to output ?
Help will be appriciated.
Thanks and best regards,
Kulwant
There is no need for UDF. U can directly use standard function "If"
and map the constants to it.
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kulwant,
put this code in your udf for geting the status depending upon the age.
Step 1: Create a simple udf named getStatus with two arguments : name and age
Step 2: After creating paste the below code in the udf editor.
public String getStatus(String name,String age,Container container){
if(Integer.parseInt(age)>18)
return "Eligible";
else
return "Not Eligible";
}
Step 3: Save & Close the udf editor and test your mapping.
Please reward points if helpful.
Regards,
Sankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
u can use the foloowin udf.
the udf is having three inputs.
a----->age
b----->name
c----->status
for(int i=0;i<a.lrength;i++)
{
if(a<i>.equals("18"))
{
result.addValue(a);
result.addValue(b);
}
else
{
result.addValue(a);
result.addValue(b);
result.addVAlue(c);
}
}
if u 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.
Kulwant,
You have one source message and two target messages is it?
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
for this you can use standard Boolean function,i.e ifwithoutelse
i think...
correct me if am wrong........
note:rewards points if solution found helpfull....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.