cancel
Showing results for 
Search instead for 
Did you mean: 

Help on UDF for truncating

Former Member
0 Kudos

I have a HTTP -> Proxy scenario where one perticular field in target structure has max 3 char length. I want to have a UDF to truncate if source filed value comes with more than 3 char length and i need to truncate first 3 char of the source field into target field. Is there any std function or sample code for writign UDF???

Please help me. Thanks.

Regards,

Vishal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Ok forget that TRIM function.

For Eg:Your source is VIKRANTH then your target should be VIK right then go for SUBSTRING you will find that under TEXT.

substring -> double click on that ->starting position will be '0' and number of characters will be '3'. that will do.

Please reward points if it helps

Thanks

Vikranth

Edited by: Khimavath Vikranth on Jun 4, 2008 9:09 PM

Edited by: Khimavath Vikranth on Jun 4, 2008 9:13 PM

Former Member
0 Kudos

Hey

Just a small correction here,before using substring you need to use length and if-else standard function to make sure that you only pass value to substring if length is greater than 3.

if length is less than 3 then just map it directly to receiver filed.

Thanx

Aamir

Former Member
0 Kudos

Hey,

You don't require an UDF for that...

when you want first 3 letters always..using substring fiunction available in XI text functions.

there in properties give starting position '0' and numbe of characters 3(substring(0,3))..this will return you the first 3 characters alwayz.

Hope this helps..

please do reward if this helps..

Thanks,

Vijaya.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If you map directly then by default it takes first 3 characters only.

Otherwise you can use substring function, double click on that function and give starting position is 0 and number of characters as 3, then also it takes first 3 characters.