cancel
Showing results for 
Search instead for 
Did you mean: 

Extend columns into Rows without using Copy Snap

mjain
New Contributor

Hi everyone,
I am stuck in one transformation I have one student_id which have different marks with subjects and I want to divide it in rows without using copy snap. PFA
The records are coming in this format
Capture

And I want to manipulate this records in This way for each ID
Capture1

I am also attaching the pipeline on which I have worked but I am searching for using less snap and without copy snap
Copy Pipeline_2020_07_08.slp (12.3 KB)

Thanks in advance

1 ACCEPTED SOLUTION

Wow, can’t believe it took me this long to learn of the Pivot snap. 🙂

Yes, that works nicely for this:

image

View solution in original post

5 REPLIES 5

ptaylor
Employee
Employee

Try this pipeline:
StudentMarks_2020_07_08.slp (5.2 KB)

It looks like this:
image

The key step is the Mapper:

Screen Shot 2020-07-08 at 9.46.32 AM

Here’s the expression on the third row:

$.entries()
.filter(pair => [‘student_id’,‘Total’].indexOf(pair[0]) < 0)
.map(pair => { Subject: pair[0], Marks: pair[1] })

Please see my article on Medium where I explore such transformations in more depth:

cstewart
Former Employee

Have you tried the Pivot Snap?

Wow, can’t believe it took me this long to learn of the Pivot snap. 🙂

Yes, that works nicely for this:

image

mjain
New Contributor

Thank @ptaylor It works