Page 1 of 1

Formatting Currency and Numbers

Posted: Wed Apr 22, 2009 8:32 am
by othni
I have a CSV file that have some currency fields.

These fields do not have the dollar ($) sign or comma (,) for separating thousands.

I want to be able to tell TextPipe to format those numeric fields with currency symbol and thousands separator (comma). And also would be nice to have the option of specifying decimal places, rounding, adding or removing sign, etc. in a filter for number formatting.

Is this something that can be done another way right now?

Thank you

Othni

Re: Formatting Currency and Numbers

Posted: Wed Apr 22, 2009 10:34 am
by DataMystic Support
Hi Othni,

Use a CSV field restriction (Filters\Restrict\Delimited fields (CSV, Tab, Pipe, etc)) to restrict to just the content of the field you need.

Inside this filter, add a Filters\Add\Left margin filter with text of '$'.

As for the commas, the best approach would be to reverse the field, add a comma every 3 characters, and then reverse it back (and then add the $ sign).

To reverse a field, use Filters\Special\Reverse each line

Re: Formatting Currency and Numbers

Posted: Wed Apr 22, 2009 11:49 am
by othni
Thank you for the quick response.

Re: Formatting Currency and Numbers

Posted: Thu Apr 23, 2009 12:23 am
by othni
Ok, I was not able to find how to insert a comma after each three numbers.

Re: Formatting Currency and Numbers

Posted: Thu Apr 23, 2009 7:55 am
by DataMystic Support
Use Filters\Convert\End of line characters
- set the input to 'Fixed length: 3'
and set the output to a comma.