Page 1 of 1

Importing Decimal field with commas

Posted: Fri Feb 09, 2007 3:35 pm
by a2love
Hi,

I'm attempting to import a field containing commas as well as decimals within the number set .

i.e.
123,020.13
987,876.00

The field is defined as decimal, however it appears it does not like the commas. I recieve the following error:

Warning:
Sequential_File_0,0: Field "huon_prem" has import error and no default value; data: {8 , 8 1 6 . 0 0}, at offset: 43 [impexp\group_comp.C:5913]

Should I define different field types? search and remove comma's with transformer?

What do you think is my best approach?

Thanks,

Posted: Fri Feb 09, 2007 3:53 pm
by ray.wurlod
Welcome aboard. :D

Read them as VarChar (or Char, if fixed width) and use a Convert() function in a Transformer stage to remove the commas. You can effect the data type conversion in the same expression.

Code: Select all

StringToDecimal(Convert(",", "", InLink.TheNumber))

Posted: Sun Feb 11, 2007 10:38 am
by michaeld
...you can see if you can change the default decimal format

if you're going to run a function like convert then make sure you do it in a MODIFY stage. A transformer stage is a waste of resources for something like this.

Posted: Sun Feb 11, 2007 1:38 pm
by ray.wurlod
Mike, can you be a bit more specific about where one can change the default decimal format in a parallel job? Are you perhaps referring to the NUMERIC category in an NLS locale?

Posted: Mon Feb 12, 2007 10:13 am
by a2love
Thanks! Convert worked perfectly.

And Roy thanks for the welcome :)

Cheers,
Adam