Skip to main content
Solved

Pivot every 13 rows into one row in target.


Forum|alt.badge.img+1

The source csv file has splitted into 13 rows for each actual row in target.By using Ataccama one desktop we would like to pivot the data by sending source 13 rows into one row in target.

 

I am trying to implement the logic below in the Text file reader step but it's not working .

 

v_RowNum =  iif(v_RowNum IS  NULL,0,v_RowNum+1)                    -------- Initialize v_RowNum to 0 if NULL; otherwise, increment it by 1 for each row.
v_CurrentNumber =  iif(v_CurrentNumber%13= 0, v_CurrentNumber+1,  v_CurrentNumber  ).    -- Increment v_CurrentNumber by 1 for every 10 rows.
GENERATED_NUMBER= v_CurrentNumber GENERATED_NUMBER INTEGER 

 

 

Please  help us  to make it work in Ataccama one desktop .

Best answer by AKislyakov

Hi @mahesh Ar

To generate same number for every 13 rows you can add following expression to the Shadow Columns section of Text File Reader:

sequence(0) div 13 + 1

 

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

2 replies

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

Hi @mahesh Ar

To generate same number for every 13 rows you can add following expression to the Shadow Columns section of Text File Reader:

sequence(0) div 13 + 1

 


Forum|alt.badge.img+1
  • Author
  • Data Pioneer
  • 6 replies
  • August 3, 2023

Thanks @AKislyakov It’s working as i expected .


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