Skip to main content
Solved

Pivoting all rows into columns in target.


Forum|alt.badge.img+1

My input file is in the below structure and looking to pivot all rows into columns.

 

No name
1 value1
2 value2
3 value3
4 value4
5 value5

 

 

 

Expecting output should be like 

 

Col1 Col2 Col3 Col4 Col5
value1 value2 value3 value4 value5

 

 

What will be the best approach in Ataccama One desktop?

 

Looking for support and help..

Best answer by AKislyakov

In that case you can group by (no-1) div 10 -- group every 10 records 

And change column expression to something like maximumif(no%10=1, name)
so records ending on 1 will go to the first column, ending on 2 -- to second and so on.

In here I assume that numbering starts with 1.

 

The result will be something like that:
 

 

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+2
  • Ataccamer
  • 146 replies
  • July 31, 2023

Hi @mahesh Ar,

Ataccama Desktop does not allow for a dynamic set of columns. Therefore, you need to decide beforehand what the maximum number of columns might be. If you are okay with this restriction, I suggest using the Group Aggregator step in conjunction with the maximumif function. The result could look like this:

In this example, I transpose up to 11 incoming rows, enumerated from 1 to 11.

In attachment a sample plan that uses Random Record Generator to generate 10 rows and the Group Aggregator step to transpose them up to 11 columns. 


Lisa Kovalskaia
Ataccamer
Forum|alt.badge.img+3

Hi @mahesh Ar, to add to the suggestion from @AKislyakov - there's often more than one way to achieve a specific result in ONE Desktop. Another solution to your case could be to use the Representative Creator step, have a look at this example here: 

 

In your case you'd set the key to Group by as true:

 

And the acceptance conditions would be set according to your identifier values:

 


Forum|alt.badge.img+3

Hi @AKislyakov , The above example will return only 1 record as we are doing MAX, If the source has many rows each needs to be transposed. For eg) Total rows: 100 , Transpose them to 10 Columns with 10 rows Each. 

Basically the loop should continue for every 10th record, i dont think the above solution will work in that case


Forum|alt.badge.img+2
  • Ataccamer
  • 146 replies
  • Answer
  • August 2, 2023

In that case you can group by (no-1) div 10 -- group every 10 records 

And change column expression to something like maximumif(no%10=1, name)
so records ending on 1 will go to the first column, ending on 2 -- to second and so on.

In here I assume that numbering starts with 1.

 

The result will be something like that:
 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings