on 07-25-2014 1:57 PM
Hi Expert,
I need a help.
My requirement is I have a filed name "Comments" in source system and this comment filed i needs to pass to the target in 3 fields.The comment value will be separated in 3 fields like 1)Details 1, 2)Details 2,and 3) Details,as a 40 character. so how can i get this output Kindly help me.Thanks in advanced.
\
Hi wasim,
are you telling that comments total length will be 120. you have to split into three part with length 40. if this is constant you can use substring function.
use standard function when length is constant. i.e it should always come with 120 length.
if length is dynamic you can use udf.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wasim,
you can use the below UDF.
Input parameter
input - input string
number - how many no of char (in your case it is 40)
pos - which position you want (1 for first 40, 2 for 2nd..)
int num = Integer.parseInt(number);
int posi = Integer.parseInt(pos);
String res = "";
if(input.length()>num*posi)
{
res = (input.substring(num*(posi-1), num*posi));
}
else
if (input.length()>num*(posi-1))
{
res = (input.substring(num*(posi-1)));
}
return res;
regards,
Harish
Hi Muniyappan,
Its working fine but every time needs to put 120 char,then only got output.
Now problem is suppose my input length is 90 char,then 40 char will go to 1st filed,then 40 filed will go to 2nd filed and reaming char will go to 3rd field.
So can you tell me how to overcome this issue.
Thanks and regards
Wasim Rana
Hi wasim,
Please find the below links might be help you.
Regards,
Rajendar K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.