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