cancel
Showing results for 
Search instead for 
Did you mean: 

Message mapping

Former Member
0 Kudos

We are using Graphical/Message mapping here.....

Problem is: I need to truncate the LAST 10 digits of a string. The source can vary in length.

e.g.

Source: 3245678567945

Target would look like: 5678567945

Analysis:

We looked all the functions available in message mapping, but nothing seems to be in this use. I thought of using the "Substring" function available in Message Mapping, but it is going to give me first 10 digits (Left to Right).

Any expert can help please?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

you need an UDF for this:

> if (a.length() > 9) {

> a = a.substring(a.length() - 10, a.length());

> }

> return a;

Regards

Patrick

Former Member
0 Kudos

Thanks to you too Patrick!!

Appreciate it!!

I'll let you know how it goes....

Former Member
0 Kudos

write simple udf

function truncateLast( String s )
{
   if ( s != null && s.length() >= 10 )
   {
      s  = s.substring ( s.length() - 10, s.length() );
   }
return s;
}

i though to truncate last 10.. so changed the params for substring.

Former Member
0 Kudos

Great! Anand, I'll try and let you know!! Thanks!