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 do I use Trim Field Nodes to remove commas from strings?

    Employee
    Posted 11-08-2013 08:17

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

    Originally posted by: dstacey

    Hi,

    I'm sure this should be easy - I want to use the Trim Fields node to remove any commas that I have in strings so that I can then convert strings of types 1,234,567 into ints

    But I can't get it too work - I've tried every combination I can think of (enclosing in quotes, \, etc) but no joy. I can remove a comma if it is part of a longer field e.g 1,23 works ok

    I'm sure I'm missing something simple!

    Thanks
    Dave


  • 2.  RE: How do I use Trim Field Nodes to remove commas from strings?

    Employee
    Posted 11-08-2013 08:24

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

    Originally posted by: dstacey

    I've just realized that trim only works at either end of the string - so the more general question I am asking is for the best way to remove , separators from fields to allow me to convert to integers.

    I'm likely to have many fields in the same dataset with this problem so ideally something that works across all the fields would be helpful - I know I could use replace statements identifying each field explicitly.

    thanks
    Dave


  • 3.  RE: How do I use Trim Field Nodes to remove commas from strings?

    Employee
    Posted 11-10-2013 05:51

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

    Originally posted by: johnpelz

    Hi Dave,

    Your best bet is to use the Replace Text node. See the attached example. The first two nodes are just generating some test data for the example -- the actual Replace Text node is what you will be most interested in.

    Hope that helps,
    -John
    Attachments:
    ReplaceTextExample.brg


  • 4.  RE: How do I use Trim Field Nodes to remove commas from strings?

    Employee
    Posted 11-11-2013 03:12

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

    Originally posted by: dstacey

    Hi John,

    That's great - thanks!

    Dave