Decimal field with Trailing negative signs
Moderators: chulett, rschirm, roy
Decimal field with Trailing negative signs
Hi,
Just wondering if anyone knew of a good way to deal with decimal fields that, if negative, have trailing negative signs on import.
Ex:
1,234.05-
22,000.00
When converting from char to decimal it does not like the negative sign.
Any suggestions?
Thanks,
Adam
Just wondering if anyone knew of a good way to deal with decimal fields that, if negative, have trailing negative signs on import.
Ex:
1,234.05-
22,000.00
When converting from char to decimal it does not like the negative sign.
Any suggestions?
Thanks,
Adam
Adam Love
Adam, how this question is answered depends upon whether is a server job (as per your "Job Type") or a PX one (as per your select forum). Which is it?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Have you tried declaring it as a decimal field, then giving it a "unpacked, separate" and "trailing sign" in the attributes?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I just attempted it.
I am recieving an error:
APT_CombinedOperatorController,0: Numeric string expected for input column 'huon_prem'. Use default value.
I am importing in as a varchar, data looks like:
".00"|"5084.00-"
"203015.00"|"189710.00" (delimited by | )
I have a transform stage adding a new column and saving the above 2 fields as decimals. This is where I am occuring issues, I am assuming a function is needed to transform to decimal however I am unaware of what to use.
I am recieving an error:
APT_CombinedOperatorController,0: Numeric string expected for input column 'huon_prem'. Use default value.
I am importing in as a varchar, data looks like:
".00"|"5084.00-"
"203015.00"|"189710.00" (delimited by | )
I have a transform stage adding a new column and saving the above 2 fields as decimals. This is where I am occuring issues, I am assuming a function is needed to transform to decimal however I am unaware of what to use.
Adam Love
Since the source data is enclosed in quotes you will need to set the quote to "double" on "edit row" so that it can be parsed and removed on input and specify the datatype as decimal.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
You can do something like
Code: Select all
If Right(in.Col, 1) = "-" then "-":left(in.Col, len(in.Col)-1) else in.Col
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
There is no need to do any string manipulation or conversion if the datatype is specified correctly in the first place.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
The string manipulation worked well, however is there a better command than len(in.col) as it returns the max length of the string, not its current trimmed length (just wondering).
Also, I agree that with a proper datatype setup this would be handled much more effectively. However, does it matter that I only will ever have a "-" on the end of my decimal and never a "+" ?
And by the way, this is one of my first times using these message boards and I am very suprised at the quick response time and knowledgeable replys. Thanks for your help !
Also, I agree that with a proper datatype setup this would be handled much more effectively. However, does it matter that I only will ever have a "-" on the end of my decimal and never a "+" ?
And by the way, this is one of my first times using these message boards and I am very suprised at the quick response time and knowledgeable replys. Thanks for your help !
Adam Love
-
- Charter Member
- Posts: 560
- Joined: Wed Jul 13, 2005 5:36 am
- Location: Ohio