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.  How to replace a 0 into a 1

    Employee
    Posted 08-27-2013 08:03

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

    Originally posted by: blokkie

    Could someone give me suggestions on how to change the first digit which is a 0 (zero) with a 1.
    The colomm is for exchange rates, we need to change rates stated as 0 with 1.

    We tried by using find and replace, which seems only to work with text fields.

    thanks


  • 2.  RE: How to replace a 0 into a 1

    Employee
    Posted 08-28-2013 13:05

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

    Originally posted by: rboccuzzi

    Sorry, I'm a little confused. What is the type of the column? If it isn't text, but rather an integer or floating point format, there won't be a leading 0, right? So I'm not sure what you are specifically working with. Another way, btw, would be to look at the "left" function, and then check the value, and then reappend, something like:

    firstChar = 'data'.left(1)
    if firstChar == "0" then
    firstChar = 1
    data = firstChar + 'data'.substr(1)

    emit *
    override emit data

    Or something like that. But again, that will only work with string or unicode fields. Please let us know what the data looks like, if that doesn't work.

    Cheers
    Rich


  • 3.  RE: How to replace a 0 into a 1

    Employee
    Posted 08-29-2013 00:23

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

    Originally posted by: blokkie

    Originally posted by: rboccuzzi
    					

    Sorry, I'm a little confused. What is the type of the column? If it isn't text, but rather an integer or floating point format, there won't be a leading 0, right? So I'm not sure what you are specifically working with. Another way, btw, would be to look at the "left" function, and then check the value, and then reappend, something like:

    firstChar = 'data'.left(1)
    if firstChar == "0" then
    firstChar = 1
    data = firstChar + 'data'.substr(1)

    emit *
    override emit data

    Or something like that. But again, that will only work with string or unicode fields. Please let us know what the data looks like, if that doesn't work.

    Cheers
    Rich

    Hi Rich,

    The type of column is double.
    your solution doesn't work at the moment, because it is expecting a string. which is not there.


  • 4.  RE: How to replace a 0 into a 1

    Employee
    Posted 08-30-2013 01:33

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

    Originally posted by: Tim Meagher

    Hi,

    I'm still a bit confused about exactly what you want in this circumstance, but assuming that you:
    • Don't want to modify the first digit if it's not 0
    • Specifically care about the first digit, not the first character (i.e. -0.1 should be changed to -1.1)
    Then the attached graph should do what you want.

    Regards,
    Tim.
    Attachments:
    DoubleConversion.brg