IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  Need logic to split a text string

    Posted 02/07/08 02:38 AM

    Originally posted by: vickey


    Hi,

    Can some one provide me the logic to split the text string into multiple text strings.

    For example.

    The input text string would be like
    "United States of America is the strongest of all countries in the world". The size of the string is 71 bytes. I want to split the string into 20 bytes each

    So the output should be like below

    "United States of
    America is the
    strongest of all
    countries in the
    world
    "

    I have developed a sample map for this but the output is coming as below: Which is not according to the requirement

    "United States of Ame
    rica is the stronges
    t of all countries i
    n the world
    "

    I have attached the map objects.

    Reply is much appreciated.

    Thanks in advance.
    -Vickey
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 2.  Re: Need logic to split a text string

    Posted 02/07/08 04:12 AM

    Originally posted by: janhess


    No one would want to create the logic to generate that text. :)

    You don't want to split it into strings of 20 bytes, you want a string of max length 20 bytes with no split in the words.

    Message was edited by: janhess
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 3.  Re: Need logic to split a text string

    Posted 02/07/08 12:34 PM

    Originally posted by: vickey


    Thanks for the reply janhess.

    But I have the requirement like this. Publisher is sending this big text string and Subscriber SAP cannot accept this big string, so they want to split that into 20 bytes each.

    :)

    I know this is very rare requirement. But any ways thanks for the help.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: Need logic to split a text string

    Posted 02/07/08 04:42 AM

    Originally posted by: LaurentB


    I imagine the proper type tree could do this, if no word is bigger than 20 characters.

    It would involve some component rules and a structure splitting the line into sublines, each subline being made of words separated by spaces, for an overall length < 20.

    I'm not absolutely sure it would works, but it's definitely worth a try (I'll ahave a lok this evening as I don't have time right now)

    If this does not works, then an interesting mapping rule may have to be written ;-)
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 5.  Re: Need logic to split a text string

    Posted 02/07/08 12:36 PM

    Originally posted by: vickey


    Thanks for the reply Laurent.

    Even i am also trying and lets see if I get any logic, Will post the same.

    Vickey
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 6.  Re: Need logic to split a text string

    Posted 02/07/08 12:54 PM
      |   view attached

    Originally posted by: LaurentB


    Hi Vickey,

    the mtt did not work since it does not do ctrl-break logic, but simply refuses the data.

    However, here's a sample map that does the trick (thanks for the fun I had developing it ;-) ).

    It still needs to have some hard-coded values (it splits the text in 5 lines, not matter how big it is), it also will create issues for words longer that 20 characters. Last (but not the least), since it relies on a side effect (due to the use of GETANDSET), the order of arguments to the functional maps is critical.

    Have fun
    Laurent
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender

    Attachment(s)



  • 7.  Re: Need logic to split a text string

    Posted 02/07/08 11:28 PM

    Originally posted by: vickey


    Thanks a lot Laurent..

    I appreciate your help.

    I executed and see the output is as expected. I will do the rest.

    I will post you once I am done.

    Once again thanks for the help.

    Vickey
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 8.  Re: Need logic to split a text string

    Posted 02/08/08 01:46 AM
      |   view attached

    Originally posted by: vickey


    Hi Laurent,

    PFA my version of the map, which will split for any number of lines.

    Really thankful for the logic.

    I tried to use the REVERSEBYTE but never got an idea to use GETANDSET this helps a lot.

    Once again thanks for the help.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender

    Attachment(s)



  • 9.  Re: Need logic to split a text string

    Posted 02/08/08 04:02 AM

    Originally posted by: SystemAdmin


    I know this is a bit off the subject but since the original problem refers to data being sent to a SAP system, you could do this in ABAP.

    The SPLIT command will break the string into an array of individual words that can then be recombined into strings of up to 20 characters. I've done similar reformatting before and found it easier in ABAP than Mercator.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 10.  Re: Need logic to split a text string

    Posted 02/08/08 04:16 AM

    Originally posted by: LaurentB


    Hi Vickey,

    yes, the GETANDSET can be amazingly powerful (but also have some strange effects, it took me 2 hours yesterday to troubleshoot the mapping, fighting with the offset values, before I figured out that doing the GETANDSET before computing the offset was a pretty bad idea).

    I know a mapping wizard (may be he'll recognize himself) who thought about using to do a tricky mapping easily :

    he needed to map fields A and B, A occuring before B but depending on B value. For this, he mapped B to A, then mapped B with GETANDSET so that GETANDSET generated A's new value based on the current A's value, set A to this new value, but returned the former value to B... I'd have mapped in two steps to do the same, which would have been a waste of time.

    Laurent
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 11.  Re: Need logic to split a text string

    Posted 02/08/08 02:56 PM

    Originally posted by: vickey


    You are awesome Laurent.

    I want to know the Mapping Wizard name. May be I can learn some tricks from him ;)

    Any ways thanks for the information.

    Vickey
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 12.  Re: Need logic to split a text string

    Posted 09/28/16 07:12 PM

    Originally posted by: TvlDev


    Hi Laurent,

     

    Could you share that map with me. I have a same requirement and unable to get that map.

    Thanks in advance

     

    M


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange