-
Notifications
You must be signed in to change notification settings - Fork 485
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
Parse Multiple lines in the same field #377
Comments
I think the same feature was requested in the #238. I don't think YAML (or Python's dict) allows using the same key multiple times. That would also require picking some merge strategy generic for all parsers. As commented in #238 we could think about something like
|
That is correct, that is what we are looking for. (indeed very similar to that reqeust, however that being an old request, the fix for that was not complete and did not get merged. Due to other code changes it needed refactoring. Hence the reason for PR378) PR 378 is supporting this, when using the following yaml syntax:
Hope this is more clear :) |
Since #308 it is possible to have multiple line parsers.
In my use case I want the line parsers to output to the same dict.
On each additional match, append it to the dict.
This is currently not possible.
Instead of appending the next line match it replaces the previous match.
Best to be explained by an example.
Step 1:
For demonstration purposes, have the items to match in a separate field.
output:
used template:
Step 2:
Now we know the template is correct, change it so it uses the same field.
Actual Output:
(HINT: the first match, category: FOOD is missing)
'lines': [{'barcode': '2231012001992', 'name': 'KROKETBROODJES', 'qty': 2.0, 'uom': 'KG', 'price_unit': 1.0, 'discount': 0.0}],
Desired output:
'lines': [{'category': 'FOOD'}, {'barcode': '2231012001992', 'name': 'KROKETBROODJES', 'qty': 2.0, 'uom': 'KG', 'price_unit': 1.0, 'discount': 0.0}],
The text was updated successfully, but these errors were encountered: