cancel
Showing results for 
Search instead for 
Did you mean: 

MAPPING Length max 26

Former Member
0 Kudos

Hi Guru

please i have a question about mapping. I need to map two sys like that:

the souce sys have length = 40 but the Target sys is DB and need only 26 string or Char.

source sys -


> name(40)

Target sys -


name (26)

please could tell me how i can resolve this step? I have trying with Graphical mapping like name----length = constant 40 -


if then -


name ---substring(0....26) but i have error

please could you give input!

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try this UDF.

Hi,

public String mapxxx(String a,Container container)

{

if(a.length()>0)

{

String b=a.substring(0,25);

return b;

}

else

return a;

}

Regards,

Soumya.

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi I think the problem you are facing is that the source system has a string of max 40, but the input need not always be 40. So what i would recommend you to do is, try and concat 40 spaces to the input.

Try something like this

Src String -->mapwithdefault(space) --> concat --> constant (40spaces) --> substring(0,26) --> target String.

Sameer

Former Member
0 Kudos

Hi,

thank you very much for the answer. Ich done this and i have for example error name can't be convert in boolean ! or i can' t see the field in the Target sys!

Thanks in advance.

Dominique

prateek
Active Contributor
0 Kudos

Use the following:

1. Use "Length" function to find length of source-name

2. Then use "if" and use "less" function to know if length is < 27

3. If yes, then map source-name to target-name

4. Else use "substring" to take string 0-26 and map it to target-name

Regards,

Prateek

former_member556603
Active Contributor
0 Kudos

Hi,

Use Standard Function Substing: on that In Starting Position u put : 0

Use Number of Characters u put : 25 and click ok.

Use like this 0 counts the first character + 25 = 26

Thanks,

Satya Kumar

Edited by: SATYA KUMAR AKKARABOYANA on May 30, 2008 2:02 PM

Former Member
0 Kudos

use substring(0,27) instead of (0,26)

Thanks

Farooq

Former Member
0 Kudos

Hi,

What exact error it is giving?Please mention in the thread.

substring is the option were u can make the 40lenght char to 26 char.

Thanks

phani

Former Member
0 Kudos

Hi,

In the DB side you have only 26 fields, so it tkes 26 only.

In the mapping you use the substring function, here you double click on that and specify the starting position(0) and number of characters(26), that means it takes 26 characters from index 0 to 25.