Joining a list with a string

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

1 Like