on 05-06-2010 6:11 AM
Hi All,
I have an input field with the payload value in the source structure as xxx_abc_yyyy_2010.txt .
I need string abc for one of the target field1 and 2010 for another target field 2.
Please suggest.
Thanks.
Hi,
your requirement is a simple text formatting and can be achieved by substring function.
So better you use the standard function itself as these are precompiled and enhances your scenario performance.
cheers,
Abhishek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
UDF for Splitting
pass 2 arguments strInput,in
strInput -- is your argument (source value- aaa_bbbb_ccc)
in -- array index parameter say 0 or 1 or 2, etc.....
================
String[] Values = strInput.split("_");
return Values[in];
=================
o/p:
Values[0] --- aaa
Values[1] --- bbbb
Source+Constant(0 or 1 0r ... ) -- > UDF -- > target
Regards
Ramg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the 'substring' function which is standard.
if you insist on a UDF, you will need to create two for each target field if you're using 3.0 / 7.0:
UDF 1 (input FFileName)
target1 = FFileName.substring(4,7);
return target1;
UDF 2 (input FFileName)
target2 = FFileName.substring(13,17);
return target2;
Regards,
Glenn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Learner,
No need of UDF,use subString function it will work for you.
Regards,
raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
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.