Joining a list with a string

hello im curious to know if there is a way to join and work using a list, basically i have a XML with several INVOICES some have multiple and some have 1 so i created a list with all then i would like to join this XML with another document as long one of the INVOICES match and then using a string manipulator change the value from that list in the XML to the new value from the new document

after all that i will transform the XML column back into XML and take out of Knime

maybe another form would be separating the XML changing the values and then fusing the document back together?

is there any way to do any of these?

Hello @Bleck,

most probably there is a way for KNIME to tackle your problem but some input data and desired output together with necessary logic would be a nice starting point for someone to help you :wink:

Br,
Ivan

3 Likes

i tried creating a copy of the document i need to use
image
on line 6 you can se
each one of those have a cProd i need to change the number of each one of those so if cProd 10012 then i need it to be 12AB7C
cProd 72665 would be something like 77778777
and so on
Right now im trying Xpath where i take all the items out on a list and then i would do the changes from there but if there is any other way like maybe with a rule engine but i myself am out of ideas
thank you for your time

Hi @Bleck, ideally uploading the xml in a form that can be processed makes it easier to give assistance. The latest version of the free chatGPT (where it has been rolled out) is our friend here :wink:

Here is the XML in text form for anybody who is able to assist:

<NFe>
    <ide>
        <nNF>12609</nNF>
    </ide>
    <det nItem="1">
        <prod>
            <cProd>10012</cProd>
            <vProd>366.64</vProd>
        </prod>
    </det>
    <det nItem="2">
        <prod>
            <cProd>72665</cProd>
            <vProd>228.12</vProd>
        </prod>
    </det>
    <det nItem="3">
        <prod>
            <cProd>32459</cProd>
            <vProd>12.99</vProd>
        </prod>
    </det>
</NFe>

Presumably you have a specific list of replacements you are going to want to do as I see no pattern in
cProd 10012 —> 12AB7C
cProd 72665 —> “something like” :wink: 77778777

If you don’t want to write a Rule Engine script, and there is no logical rule to the transformations, then an alternative would normally be some kind of lookup list of replacements (i.e. a table containing the substitutions)

Old cProd New cProd
10012 12AB7C
72665 77778777
etc

You’d then do a join on that (or a value lookup) to perform replacements, before then regenerating the XML