Skip to Content
avatar image
Former Member

mapping help Spliting string

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    May 17, 2010 at 10:00 AM

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

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

    Cheers,

    André

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    May 17, 2010 at 09:49 AM

    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;

    }

    Add comment
    10|10000 characters needed characters exceeded