LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Double Data Type Conversion & Formatting

    Employee
    Posted 06-04-2015 06:59

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: moko

    Hi,

    I am looking to convert an attribute from Double back into a String format but the approaches that I have tried so far have been unsuccessful. Below you will see an example of the data used, with RMS_NOTIONAL_TEST being the converted attribute:


    RMS_NOTIONAL:double RMS_NOTIONAL_TEST:string
    -15000000.0 -1.50E+07
    -5000000.22 -5.00E+06
    NULL NULL
    -30000000.0 -3.00E+07
    -5000000.10 -5.00E+06



    Ideally I am looking for a solution where RMS_NOTIONAL_TEST will output the exact same results format as RMS_NOTIONAL but also converted to a String. I have been looking into using format() but with no joy as yet.

    Do any of you have any suggestions?

    Thanks in advance!


  • 2.  RE: Double Data Type Conversion & Formatting

    Employee
    Posted 06-04-2015 07:03

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ejones

    Hi Michael,

    To get more control over how numbers are formatted, look up the format() function in help. Below I used the %f format to always write the number without ever using the exponential notation.

    f = if 'RMS_NOTIONAL'.isNull()
    then str(null)
    else format("%f",'RMS_NOTIONAL')
    emit f as "format_f"

    See the attachment for additional options.
    Attachments:
    x.brn


  • 3.  RE: Double Data Type Conversion & Formatting

    Employee
    Posted 06-04-2015 07:17

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: moko

    Perfect! Thanks for the quick response


  • 4.  RE: Double Data Type Conversion & Formatting

    Employee
    Posted 06-18-2015 09:55

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: rbeliz000

    I would like to convert several columns in a file from string format, basically the inverse of this original post . What is the best method for doing accomplishing this? Any guidance would be much appreciated.

    thanks.


  • 5.  RE: Double Data Type Conversion & Formatting

    Employee
    Posted 06-18-2015 10:04

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ejones

    The answer to that might be trivial, lets see if it works for you. Use the double() function.
    d = double("123456.789")

    or
    s = "12345.678"
    d = double(s)