cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping requirement

Former Member
0 Kudos

In message mapping, my source field length is of 7. And target field length is of 7.

Now I need to pass source field to target field with a comma after first 4 digits.

ex: if source field value is:123456,then I need to pass the value 1234,56 to target.

Which XI standard function wll help me.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hello,

like i said before you can do it with 2 substring and 1 concat function.

if your source field is SOURCE = 123456

Put your SOURCE-Field two times in the editor and use the substring function and the concat function like this:

SOURCE --> substring(0, 4)

-


> concat(,) --> TARGET

SOURCE --> substring(4, 6)

your TARGET will look like 1234,56

If you enter the values of the substring function -> the second value is the count of characters of the substring and NOT the second index.

So in the second case you write substring(4,2) and displayed will be substring(4, 6) !

Regards

Patrick

Former Member
0 Kudos

Hi Naresh,

What you can do is use the Substring and Concat functions together in the following manner.

To your source field, put a Substring function which takes the values from position 0, characters 4

Then put the Substring function for taking the rest of the values i.e from position 4, characters 3.

Concatenate these two using the Concat function, and use the comma as ur Delimiter in the properties.

The output then goes to the target.

The point here is that your target field cannot be of length 7, because the comma is an extra char. Hence, the target field must be of length 8.

Hope the solution helps.

Regards,

Lavita.

P.S. Do reward points if the information is useful.

former_member267355
Active Participant
0 Kudos

Hi,

Create a User defined function

String first = a.substring(0,4);

String second = a.substring(4,6);

String C = first","second;

return C;

Copy and paste this code.You ll get the required output.

Regards,

Sakthi

Former Member
0 Kudos

Hi Naresh,

U can achieve this by using standard Substring,Concat & Constant function.

Fieldname -> substring(0 to 4)-\Concat------\

Constant(,)--


/
\Concat
-----TargetField

Fieldname----substring(4 to 6)--


/

Thanks,

Maheshwari

Edited by: Maheshwari Morbale on Feb 8, 2008 10:01 AM

Former Member
0 Kudos

Hello,

you could use two substring functions for the digits and one concat function with a ',' as separator.

Regards

Patrick