Hello having a bit of a problem with Xpath i dont even know if Xpath would be the best to work with
so i have many invoices each invoice has a different amount of products so im trying to add in the same row the invoice number the product number and the price
some invoices have Many (up to 20 products) some have only one
i made an example of the invoice and the way i want to make it unfortunately on Xpath i need to do every single one by hand and if in the future the invoice comes with more than the number i set up that can end up causing problems so i want to know if there is a way of just adding all to the same column directly and also just get the amount of rows to be created directly from the Xpath
here an example of the XML
here how i would like to make it
and here is how im trying to make the Knime
Can you please share the example in the workable format? It’s quite a bit to manual type over It would also help if you can share a second dummy example of the situation you are describing with a different lay-out so that people can more effectively help you out with a solution.
There are some options available here, including searching for the tag name which does not require its position to be hardcoded.
then in front of each one of those a Invoice with its price
some invoices have a single one
and there is one that has 51 different products bought on it
i hope this explains and if its possible to do it as i need
thank you for your time
In the XML reader, select Files in Folder and list the directory where all the xml’s all located. It will then load the contents of all files to be used.
With the Xpath node, create queries for the field you would like to have. Note: I don’t see yProd so I took vProd, the principle is the same. The trick here is to use wildcard and the Multiple Rows features.
As such, if you then replace the fixed value of 1,2,3 with a wildcard it will automatically retrieve all data regardless of how many nItems you have. Same applies for the others fields.
Final query: /dns:nfeProc/dns:NFe/dns:infNFe/dns:det[*]/dns:prod/dns:vProd