IBM Sterling Transformation Extender

Sterling Transformation Extender

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


#Sterling
#Supplychain
 View Only
Expand all | Collapse all

decimal to decimal mapping, zeros removed

  • 1.  decimal to decimal mapping, zeros removed

    Posted 06/16/09 12:30 PM

    Originally posted by: SystemAdmin


    When mapping a character/decimal field directly from input to the same output field (without any functions/modifications), how do you avoid having the leading/trailing zeros removed?

    f.ex.:
    0123,10 -> 123,1
    12,000 -> 12,

    The output needs to look exactly as the input, easy right? ;)

    Field definition:
    min 1, max 14, format ###,##
    no sign, no pad
    decimal min 0, whole min 1

    Thanks all (using TX 8.0).
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 2.  Re: decimal to decimal mapping, zeros removed

    Posted 06/16/09 02:43 PM

    Originally posted by: repanzer


    My suggestion for any of these types of questions would be to create a type tree with one field, add it to an output card of a new map, hardcode values in there and test. Keep messing with the settings until you get what you want, of which, I believe you need the “pad” setting.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 3.  Re: decimal to decimal mapping, zeros removed

    Posted 06/16/09 02:44 PM

    Originally posted by: repanzer


    And you need "places" for the number of min and max decimal places. Mess with it and you'll see what I mean.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 4.  Re: decimal to decimal mapping, zeros removed

    Posted 06/17/09 03:41 AM

    Originally posted by: SystemAdmin


    I am already using the "places" settings: decimal min 0, whole min 1
    The problem is you can only specify a range or a fixed format

    But the number format is variable and the decimal/whole number positions are not fixed.
    "Pad" is also of no use, for the same reasons...
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 5.  Re: decimal to decimal mapping, zeros removed

    Posted 06/17/09 09:06 AM

    Originally posted by: repanzer


    If you just want to move the value from the input into the output, define the output as text and do a "NUMBERTOTEXT()" and it will move whatever string is in the input into the output.

    By the way, you're example looks bad to me.

    0123,10 is not the same format as 12,000. One has leading 0's (0123,10), one doesn't (12,000), one has 3 min decimal places(12,000), the other doesn't (0123,10).
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 6.  Re: decimal to decimal mapping, zeros removed

    Posted 06/17/09 12:42 PM

    Originally posted by: SystemAdmin


    As written in my original post, I can not/do not want to use a formula as the field is contained deep in nested groups and the root group is actually moved as is.

    The examples are good and match the format described in my original post. I am not using any padding or a fixed number of decimals.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 7.  Re: decimal to decimal mapping, zeros removed

    Posted 06/18/09 03:10 AM

    Originally posted by: Kepa_Screen


    This is not a forum for trivial questions...

    • If you don't want to use formula in your rules, why use TX ?, just programm in C, pl-sql, or whatever other thing.

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


  • 8.  Re: decimal to decimal mapping, zeros removed

    Posted 06/17/09 03:09 PM

    Originally posted by: repanzer


    Something is fundementailly wrong with this;

    "When mapping a character/decimal field directly from input to the same output field"

    To me, that means the input and the output field have the same definition.

    And if you're trying to tell me that this input field;

    0123,10

    has this format:

    Field definition:
    min 1, max 14, format ###,##
    no sign, no pad
    decimal min 0, whole min 1

    Please, build an output card with one field with that exact definition, hardcode "=0123,10" in the field , look at your output (123,10) and tell me how you get the "0" before the 123.10, without using a pad character.

    "As written in my original post, I can not/do not want to use a formula as the field is contained deep in nested groups and the root group is actually moved as is."

    Unless you're talking about another thread, your original post does not say that you can not/do not want to use a formula, nor does it say anything about the field being nested. All that it asks is "how do you avoid having the leading/trailing zeros removed", and I answered you.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 9.  Re: decimal to decimal mapping, zeros removed

    Posted 06/18/09 03:52 AM
      |   view attached

    Originally posted by: SystemAdmin


    @repanzer

    I think there is a misunderstanding (I hope ;)).

    The example "0123,10 -> 123,1" means that I have as input (input card, file source) the number 0123,10 and I get as output (output card, target file) the number 123,1. All the numbers match the described format.

    I attached a .zip containing a simple example.

    I wrote in my original post "(without any functions/modifications)", I know that you could use f.ex. the function NUMBERTOTEXT() (in a simple example). Of course I could have been a bit more clear, I agree.

    Suppose you have to process/modify complicated SWIFT messages with many numbers contained (deep nested, in choice structures etc.) where large parts of the message need to remain untouched and the original format of the numbers preserved.

    @Kepa

    This is not a trivial question and your response does not even make any sense. Thanks for your help though.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange

    Attachment(s)



  • 10.  Re: decimal to decimal mapping, zeros removed

    Posted 06/18/09 06:23 AM

    Originally posted by: Kepa_Screen


    Sorry, i misundestood the question.
    I thought it was trivial to pass from 0123,10 --> 123,1
    As you say, with numbertotext() could be done very easy.
    But if you don't want to use functions....i told to you to use other methods...not TX. Now, i have more info, ...if you are using it for SWIFT transactions...ok, you would like to continue using TX to resolve it.

    I don't understand your requirement of not using functions.
    Why not ? Only because there are too much item/rules involved and they are very nested ?
    Could you use "type" rules at those items at the .mtt ?
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 11.  Re: decimal to decimal mapping, zeros removed

    Posted 06/18/09 03:36 PM

    Originally posted by: repanzer


    I miss understood a bit also, but I’m with Kepa.

    You’re either going to have to alter the type tree or use a function.

    Maybe a partition? Then on the partitioned field, use logic;

    If condition X, then map this output type, else, map this output type.

    I understand the concern for altering a type nested deep in the structure, but if you’re not getting the results you want, something has to change.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 12.  Re: decimal to decimal mapping, zeros removed

    Posted 06/19/09 01:49 PM

    Originally posted by: SystemAdmin


    If you want the character output the same as the character input, define the item as character, not a number.

    If you want to use the 'numeric' value of this character for something later, TEXTTONUMBER() comes to mind.

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