Topic
  • 7 replies
  • Latest Post - ‏2012-12-14T23:46:15Z by SystemAdmin
SystemAdmin
SystemAdmin
6184 Posts

Pinned topic How can delete non-numeric data from my input data

‏2012-12-14T15:58:56Z |
Hello everyone.

How i can delete non-numeric data from my decimal field ? For example i got the following number ( 383.7064628) and my desired result is (3837064628) i used the LEAVENUM function , configured my field item subclass in number and the pad value to <sp> without success.

Any ideas?
Regards from Colombia
Cristian.
Updated on 2012-12-14T23:46:15Z at 2012-12-14T23:46:15Z by SystemAdmin
  • mikedb
    mikedb
    6 Posts

    Re: How can delete non-numeric data from my input data

    ‏2012-12-14T16:26:49Z  
    The type for your input/output and actual rule you're using would be helpful. That being said, remember this function works on a text item and returns a text item. If your input is a number and your output is text:

    =LEAVENUM(NUMBERTOTEXT(SomeNumber:In1))

    If your input is a number and your output is a number:

    =TEXTTONUMBER(LEAVENUM(NUMBERTOTEXT(SomeNumber:In1)))
  • SystemAdmin
    SystemAdmin
    6184 Posts

    Re: How can delete non-numeric data from my input data

    ‏2012-12-14T16:48:01Z  
    • mikedb
    • ‏2012-12-14T16:26:49Z
    The type for your input/output and actual rule you're using would be helpful. That being said, remember this function works on a text item and returns a text item. If your input is a number and your output is text:

    =LEAVENUM(NUMBERTOTEXT(SomeNumber:In1))

    If your input is a number and your output is a number:

    =TEXTTONUMBER(LEAVENUM(NUMBERTOTEXT(SomeNumber:In1)))
    Hello and thanks for your answer.

    I'm just test your suggest solution and based in my input (xsd:decimal) and my output (decimal) i took the second option of your answer. However it show the error " one or more inputs was invalid" and in the results of the map trace appear my number with the spaces and the dot (.) And the errors "failed item presentation test for TYPE" and "INVALID data for type".

    It's some type of special protocol with the decimal data? Why the decimal presentation is interpreted as character?
    Thanks ans regards from Colombia
    Cristian

    PS: sorry for the double post, an error with my mobile network causes what i send two post of the same question.
  • SystemAdmin
    SystemAdmin
    6184 Posts

    Re: How can delete non-numeric data from my input data

    ‏2012-12-14T17:13:49Z  
    Hello and thanks for your answer.

    I'm just test your suggest solution and based in my input (xsd:decimal) and my output (decimal) i took the second option of your answer. However it show the error " one or more inputs was invalid" and in the results of the map trace appear my number with the spaces and the dot (.) And the errors "failed item presentation test for TYPE" and "INVALID data for type".

    It's some type of special protocol with the decimal data? Why the decimal presentation is interpreted as character?
    Thanks ans regards from Colombia
    Cristian

    PS: sorry for the double post, an error with my mobile network causes what i send two post of the same question.
    The error in your trace file has nothing to do with your map rule. Your map never got to trying to output data. Validation is only performed as your input data is read. So your input type tree doesn't match your input data.

    If your input element is formatted like the following type tree export, you should be able to read it in:

    <ITEM SimpleTypeName="DIVISA_TASA" CategoryOrItemParent="Field CopyBook" Description="DIVISA-TASA" partition="NO" OrderSubtypes="ASCENDING">
    <CharNumber>
    <Decimal>
    <TotalDigits Min="0" Max="13"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="13" SizedAs="BYTES"/>
    </PadNumber>
    <DecimalFormatString>{####http://&apos;.&apos;##}</DecimalFormatString>
    </Decimal>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
  • SystemAdmin
    SystemAdmin
    6184 Posts

    Re: How can delete non-numeric data from my input data

    ‏2012-12-14T19:27:20Z  
    The error in your trace file has nothing to do with your map rule. Your map never got to trying to output data. Validation is only performed as your input data is read. So your input type tree doesn't match your input data.

    If your input element is formatted like the following type tree export, you should be able to read it in:

    <ITEM SimpleTypeName="DIVISA_TASA" CategoryOrItemParent="Field CopyBook" Description="DIVISA-TASA" partition="NO" OrderSubtypes="ASCENDING">
    <CharNumber>
    <Decimal>
    <TotalDigits Min="0" Max="13"/>
    <PadNumber Justify="RIGHT" ApplyPad="ANYCONTEXT"><PadValue><SP></PadValue>
    <PaddedToFixedSize Length="13" SizedAs="BYTES"/>
    </PadNumber>
    <DecimalFormatString>{####http://&apos;.&apos;##}</DecimalFormatString>
    </Decimal>
    <Western CharSet="NATIVE"/>
    <ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
    </CharNumber>
    </ITEM>
    Hello and thanks for your answer;

    So, if the problem does nothing to do with the map, it seems that the input is the principal item to check the text input for the map, if this is true, where i can tailor this line?

    <DecimalFormatString>{####http://'.'##}</DecimalFormatString>

    Checking all the project, i dont see any syntax error, for each try to "map" correctly with functions and so on, i can never got to eliminate this dot "." in my text input, i test this deleting manually the char in the text input and the map goes to "Input valid but unknown data" validation, i only need to eliminate the spaces and the character "." of my text input. I test the functions given by another cooperator in this thread (thanks for this code lines :D ) but every test i gon by result an error. its my first time working with decimal data, and i can t believe that it was to troublesome to tailor.

    If i can delete this character (.) i can successfully deploy the development. Exist another method to delete non-numeric chars in a text input?

    Regards from Colombia;
    Cristian.
  • SystemAdmin
    SystemAdmin
    6184 Posts

    Re: How can delete non-numeric data from my input data

    ‏2012-12-14T20:37:09Z  
    Hello and thanks for your answer;

    So, if the problem does nothing to do with the map, it seems that the input is the principal item to check the text input for the map, if this is true, where i can tailor this line?

    <DecimalFormatString>{####http://'.'##}</DecimalFormatString>

    Checking all the project, i dont see any syntax error, for each try to "map" correctly with functions and so on, i can never got to eliminate this dot "." in my text input, i test this deleting manually the char in the text input and the map goes to "Input valid but unknown data" validation, i only need to eliminate the spaces and the character "." of my text input. I test the functions given by another cooperator in this thread (thanks for this code lines :D ) but every test i gon by result an error. its my first time working with decimal data, and i can t believe that it was to troublesome to tailor.

    If i can delete this character (.) i can successfully deploy the development. Exist another method to delete non-numeric chars in a text input?

    Regards from Colombia;
    Cristian.
    When you're building a map, you first do nothing but define your input card. Then turn on the trace for input. Until you can read your data without generating an .MTR trace file, there is no reason to continue.

    What I provided was the export of the type tree for the stated field, DIVISA_TASA. The decimal is formatted under Item Subclass=Number, Presentation=Decimal, Size=Min:0,Max:13, Separators=Yes:Format=####http://.##,Pad=Yes,Value=<SP>,Padded to=Fixed Size, Length=13, Sized as=Bytes, Justify=Right The forum app messed up the my previous post. The format I used was 4 pound signs, left bracket, decimal point, 2 pound signs, right bracket. There are other formats available via a drop down list and I believe you can define your own.

    When I run your map using your map rule, "=TEXTTONUMBER(FILLLEFT(LEAVENUM(NUMBERTOTEXT(DIVISA_TASA Field:entradafuncional)),"0",200))", I get:

    <tns:divisa>
    <tns:codigoDivisa>ARS</tns:codigoDivisa>
    <tns:codigoPais>ARN</tns:codigoPais>
    <tns:nombre>NUEVO PESO ARGENTINO</tns:nombre>
    <tns:tasa>3837064628</tns:tasa>
    <tns:fechaCambio>2012-10-29</tns:fechaCambio>
    </tns:divisa>

    The following also works. TEXTTONUMBER strips off the zeroes you add by the FILLLEFT.

    =TEXTTONUMBER(LEAVENUM(NUMBERTOTEXT(DIVISA_TASA Field:entradafuncional)))
    /* =TEXTTONUMBER(FILLLEFT(LEAVENUM(NUMBERTOTEXT(DIVISA_TASA Field:entradafuncional)),"0",200))
  • SystemAdmin
    SystemAdmin
    6184 Posts

    Re: How can delete non-numeric data from my input data

    ‏2012-12-14T21:30:37Z  
    When you're building a map, you first do nothing but define your input card. Then turn on the trace for input. Until you can read your data without generating an .MTR trace file, there is no reason to continue.

    What I provided was the export of the type tree for the stated field, DIVISA_TASA. The decimal is formatted under Item Subclass=Number, Presentation=Decimal, Size=Min:0,Max:13, Separators=Yes:Format=####http://.##,Pad=Yes,Value=<SP>,Padded to=Fixed Size, Length=13, Sized as=Bytes, Justify=Right The forum app messed up the my previous post. The format I used was 4 pound signs, left bracket, decimal point, 2 pound signs, right bracket. There are other formats available via a drop down list and I believe you can define your own.

    When I run your map using your map rule, "=TEXTTONUMBER(FILLLEFT(LEAVENUM(NUMBERTOTEXT(DIVISA_TASA Field:entradafuncional)),"0",200))", I get:

    <tns:divisa>
    <tns:codigoDivisa>ARS</tns:codigoDivisa>
    <tns:codigoPais>ARN</tns:codigoPais>
    <tns:nombre>NUEVO PESO ARGENTINO</tns:nombre>
    <tns:tasa>3837064628</tns:tasa>
    <tns:fechaCambio>2012-10-29</tns:fechaCambio>
    </tns:divisa>

    The following also works. TEXTTONUMBER strips off the zeroes you add by the FILLLEFT.

    =TEXTTONUMBER(LEAVENUM(NUMBERTOTEXT(DIVISA_TASA Field:entradafuncional)))
    /* =TEXTTONUMBER(FILLLEFT(LEAVENUM(NUMBERTOTEXT(DIVISA_TASA Field:entradafuncional)),"0",200))
    Hello;

    I can´t believe that the separators and the decimal format was the cause of the problem, really i don't know about this option in the mapping properties, thanks again for your help and your patience, now i can continue with the rest of the development of my project.

    One more question, where i can find training for WTX and Datapower? like videos or recorded webinars? i got a good number of PDF's but a got a little experience with both software.

    Thanks and Regards from Colombia
    Happy Holidays;

    Cristian.
  • SystemAdmin
    SystemAdmin
    6184 Posts

    Re: How can delete non-numeric data from my input data

    ‏2012-12-14T23:46:15Z  
    Hello;

    I can´t believe that the separators and the decimal format was the cause of the problem, really i don't know about this option in the mapping properties, thanks again for your help and your patience, now i can continue with the rest of the development of my project.

    One more question, where i can find training for WTX and Datapower? like videos or recorded webinars? i got a good number of PDF's but a got a little experience with both software.

    Thanks and Regards from Colombia
    Happy Holidays;

    Cristian.
    See https://www.ibm.com/developerworks/forums/thread.jspa?messageID=13990903&#13990903

    Also my earlier posting today entitled "Free online training WTX sandbox for beginners".