Order of columns when processing XML

I try to process a XLM-file (sample).
But the order of the columns are alphabetic.
I would like to get the columns in the same order as topdown from the XML.
Is that possible?

Currently it preserves the order if you set XML Format as Wide, but not for Long. I will look into it a bit more.

Turns out it is an easy fix. I will try to get it in the next release.

1 Like

Note that:

  • It will follow the order of the first row read in (the XML might not have consistent ordering).
  • This might change the behaviour of existing .transforms inputting XML as long.
  • If you want to enforce the column order, use a Stack transform, see ‘Same columns with the same names, but in a different order’ here:
    How do I? > Handle column name/order changes in inputs
1 Like

I can use a workaround by reading input as Wide and then use Split Rows to get the desired output.

Glad that works. I have done the fix and it will be in the next release.

1 Like

The fix is here:

Let us know if it works ok.

I have tried it now, but it does not follow the order completly.
See this Excel-output compared to this from the XML.

Is the order and number of nodes the same for every …?

No. Some products have more assets images.

If you have a different number of nodes or different node names in each ‘record’ then there isn’t really a definitive order that we can follow. I guess you’ll have to use a Stack plus a header with the desired order.

Thanks. I will look into.
But still glad for the fix, which makes it better than the alphabetic sorting.

1 Like