-
-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amount %amt @@ -%amt is not allowed when %amt is negative; CSV import #2162
Comments
Sorry I missed this report! I think it's normal that the journal parser rejects these unusual signs in a cost amount. Though perhaps it should be made to accept +, and the parse error message could be improved. The special handling for --, +, and () is done in the csv reader, which runs first.
So it's Functioning As Documented. I can see it would be consistent to allow this in cost amounts also, but I am guessing it might be a little bit hard to implement; you'd probably have to do it within the (complex) amount parser itself, in the journal reader. But has this come up in real world data ? |
I found this issue when I tried to import real CSV file, it was a file from bank related to a credit card. I do not remember details now, I opened this issue a half year ago. I assume I have found some workaround. I think that my CSV file had records similar to "test3" example and when I tried to find a way to rewrite my rules I have found other issues. UPDATE, I have not finished my import rules and I see new issue now... ;-) I define
I fill only |
@simonmichael re:
I'm a little confused by this because the following does negate the absolute cost in this example: test.csv
test.csv.rules
In fact this seems to work with per-unit costs as well - changing the rules file to:
Yields
So the cost amounts are getting correctly negated here - including negation of negative values. This seems to be a corner case due to my implicit usage of So I'm guessing something about parsing the currency here changes the behavior. |
For me it's helpful because of my usage of
But doing so with |
@@ cannot parse negative amounts (
@@ -%amt
results in@@ --123.45
and that is a problem for a parser)Error:
CSV file to replicate the bug. The first 2 lines are imported without issue but third line is troublemaker because it has negative numbers:
CSV rules import file:
Even positive numbers could be troublemakers:
The text was updated successfully, but these errors were encountered: