cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Converts the Columns into Rows

saisantosh25
New Contributor II

hi ,

I have a requirement where in to read the .xls file which is having data and transpose the columns into rows and create a csv file as a output . Below is the screenshots for the input and output . i tried in pivot its working but the columns will be dynamic . Suppose pid and pname is constant but the data coming in the file varies day to day . Is there anyway that we can achieve this scenario . Input Output

4 REPLIES 4

Precy
New Contributor

Hi,

Did you find out a solution for this in snaplogic?If yes, can you please share with me . I kind of need similar to this for my workcase.

agt0613
New Contributor

Hi Precy,
Did you ever find a solution for this? I have the same use case.

Precy
New Contributor

Hi,

I used below function to get it done.

$.entries().filter(x => ['Fields to be not part of pivotโ€™].indexOf(x[0]) == -1).map(x => { Fieldname: x[0], Field Data Column Name : x[1] })

koryknick
Employee
Employee

You basically want to look at the Array functions to do something like this generically.

https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438091/Array+Functions+and+Properties

Iโ€™ve attached a sample pipeline that converts the date columns into an array then uses JSON Splitter to get individual records.
Generic Pivot Example_2021_03_30.slp (4.7 KB)