cancel
Showing results for 
Search instead for 
Did you mean: 

Transpose column to Row

virender_prajap
New Contributor III

Hi, I am not able to do easy transpose. I tried many snaps nut not able to solve this.Transpose
Please help to transpose column into row

6 REPLIES 6

Hello everybody,

Can someone help me with exactly the opposite.
image to image

Also, in my challenge, the names of columns and number of columns will change(dynamic).

Thanks in advance,
Sunil

If this wasn’t the case, I would suggest the Pivot snap. But, since it is, I think you’ll need to use an expression like the following:

$.entries().map(col => { Category: col[0], DataType: col[1] })

The entries() method will return a list of all the properties in the input document as pairs. The .map() method and callback then turn the pairs into their own objects. You can then follow up with a JSONSplitter to turn the array output by that expression into a series of documents.

Here’s an example pipeline that does that:

PivotProperties_2019_09_16.slp (6.9 KB)