on 06-14-2008 3:21 AM
Hi,
I tried to split name into fname,mname,lname at receiver side.I used UDf for that.But i'm getting the fname to all the three elements.Please help me to resolve this issue.
UDF:
String[] splitCodes = null;
for(int i = 0; i < inputVal.length; i++)
{
if( !(inputVal<i>.equals("")))
{
splitCodes = inputVal<i>.split(";");
for(int j = 0;j<splitCodes.length;j++)
{
result.addValue(splitCodes[j]);
}
}
}
if i provide a;b,c at source side i'm getting a for the 3 elements.
Hi Radhika,
I tried to compile your code, doesn't work. Perhaps you can try the following:
1.) Create a UDF of type 'simple' and add two parameters, 'inputVal' and 'index'.
2.) Apply the following coding for your UDF:
int indexInt = Integer.parseInt(index);
String[] splitCodes = null;
splitCodes = inputVal.split(";");
if((indexInt >= 0) && (indexInt < splitCodes.length)) {
return splitCodes[indexInt];
} else {
return "";
}
3.) Now you can use this UDF for your three output fields, always with name and a constant as input fields. For fname, you define the constant value '0', for mname you define '1' and for lname you define '2'.
Please reward points if this could help you.
Cheers,
Matthias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks to all for ur support.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Math,
Thanks for ur reply.
I'm getting the output if i gave the seperator ",".But i'm not getting the output if i put "."(dot).Why this problem occurs?
Please give Reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this code
String [ ] StrArray = inputVal.split(" "); // will sppit name into 3
result.addValue(StrArray[0]);
result.addValue(StrArray[1]);
result.addValue(StrArray[2]);
Edited by: Mugdha Kulkarni on Jun 16, 2008 7:55 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for(int j = 0;j<splitCodes.length;j++)
{
result.addValue(splitCodes[j]);
}
Looking at this it seems that you are adding all the three values in single context.
write 3 UDF to one for each and use it as
result.addValue(splitCodes[j0);
splitCodes[0] , 1 or 2 based on where you are mapping.
Gaurav Jain
Points if answer is helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try the following code,
String[] splitCodes = null;
for(int i = 0; i < idVal.length; i++)
{
splitCodes = idVal<i>.split(";");
int posVal = Integer.parseInt(position[0]);
if(posVal < splitCodes.length)
result.addValue(splitCodes[posVal]);
else
{result.addValue(ResultList.SUPPRESS);
}
}
depending upon 3 element put hte value either 0 , 1 or 2 in position[0].
Regards,
Rohit
Reward points if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
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.