cancel
Showing results for 
Search instead for 
Did you mean: 

mapping help Spliting string

Former Member
0 Kudos

Hello Experts,

My requirement is,

Source:

MT_Elemica_Orders_Out
       Orders_Create
                 OrderString     length 140

Target:

MT_B2B_DB
    Orders_Update  1to Unbounded
           TEXTLine       length 70
           TextFormat

If the length of the source fields is more then 70 characters then I want below output in target structure

Expected:Traget:

MT_B2B_DB
    Orders_Update
        TEXTLine (first 70 charcters)
        TextFormat(* (Constant))
        TEXTLine(Remaing characters after 70)
        TextFormat(= (constan)).

How can I achieve this????

many thanks,

Jam

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

There is a Text Function "length" in graphical mapping.

Use it in combination with if....else....

Cheers,

André

Former Member
0 Kudos

Hi Andre,

I know how to find the length of string,but my requirement is different.

Many Thanks,

Jam

Former Member
0 Kudos

Hi jam

This is do able very easily using standard functions; below is some outline

1) Use length function & Substring function

so lets say you input que is xyz

xyz -> length -> if -> greater than 70

substring (1, 70) and map that into your first segment

then

substring (70, length) inot second segment

I hope this is helpful

regards,

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

It is very simple, if you are going to get min 70 characters then check the condition mentioned by miamac and use substing.

for second argumnet use substing(70,0),the second argument will hold the remaing string.

checking condition also not required if you are going to get more that 70 characters.

Regards,

Raj

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jam,

Write an UDF

public String subStr(order String, Container container) throws StreamTransformationException

{

String output="";

if (!"".equals(orderString))

{

if (!orderString.lenght()<= 70)

{

output=orderString.subString(0,OrderString.lenght()-70);

}

else

{

output=orderString;

}

}

else

{

output=orderString;

}

return output;

}