Covert comma separated decimal field to DataStage decimal
Moderators: chulett, rschirm, roy
Covert comma separated decimal field to DataStage decimal
Any one know a good way to convert an input field of comma separated decimal (for example 12,345.67) to DataStage decimal field? It seems that the implicit conversion doesn't work. Any formatting option can be used with explicit conversion (such as StringToDecimal function)?
MK
Use
Code: Select all
StringToDecimal(CONVERT(',','',in.Col))
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Its how the data is read from source. If its extracted as character, it has to be converted into Decimal and as the process the comma need to be excluded.
Defaults tab in Job Property will also help in specifying a different Decimal separator other than .(period).
Defaults tab in Job Property will also help in specifying a different Decimal separator other than .(period).
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
As Ray would put it sometimes, "Stop thinking like a server developer !!!"harryn wrote:Is this the only way to handle this situation? I would have thought that comma in decimal figure is basic stuff and should be handled either implicitly or explicitly with format string?
DataType conversions are present in Enterprise Edition for this very reason, that type conversions need to be explicit, even for basic stuff.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
The parallel sequential file input stage is supposed to handle implicit conversions of fields to numeric and decimal - unless the extract developer has cocked it up and put formatting into a data exchange field, such as the commas. You could dig into the column properties and see if you can define a mask for the field. There are various format options you can add to an input column. I don't use them that much, I prefer to explicitly convert it in a transformer for transparency.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn