Pivot back to original dataset

Hi,

I want to replace alle empty cells with “\N” in my dataset because when I export this to CSV I can import the empty values as NULL values in MySQL.

In an earlier post I have learned that a table wide replace is not possible. In order to avoid putting a replace of the type ifempty() for each column I thought I could achieve this by first unpivoting my dataset, do the replace and then pivot back to the original dataset. However, when performing the final step, it seems not possible to get back to the original dataset. I have posted some screenshots with a sample dataset. Why is it not possible to get alle the rows back as in the original dataset ?

It could also be handy to be able to specify a character value for empty() values when exporting to CSV.

It is possible to preserve the table after unpivoting back.

Enumerate rows before pivoting using the “Enumerate rows” action. After unpivoting, sort by the row numbers to restore the original order of rows, and remove the column with row numbers. Columns will be sorted alphabetically.

Thanks for the suggestion. I have tried it out but I end up with more rows as in the original dataset.
In the third screenshot below, you can see my original dataset.
Am I doing something wrong ?

Yes, reading answers :slight_smile: Enumerate before pivoting, not after.

See the attached example. It applies a formula to all values in a dataset at once.

unpivot-pivot.morph (3.8 KB)

Ok thanks my fault !