Skip to main content
Solved

Can you please help in getting incremental number in split operation

  • October 18, 2024
  • 4 replies
  • 59 views

Forum|alt.badge.img

hi Team, 

i need to split a word based on a delimiter and try to add inceremental number to it, can you please help in acheiving this scenario.

Input : select * from order;select * from customer

output should be like select * from order - query 1, select * from customer - query 2

i itried using split operator , but could not able to append the incremental number

Best answer by ivysakh

Hi @rajeswarimyla ,

You can achieve this by adding an expression that will use the running sequence and a grouping step. Updated component is attached herewith. 
 

 

4 replies

Forum|alt.badge.img
  • Author
  • Space Explorer
  • October 21, 2024

Can you pls provide update on above ask


ivysakh
Space Explorer
Forum|alt.badge.img+3
  • Space Explorer
  • October 21, 2024

Hi @rajeswarimyla ,

You can modify the component from https://community.ataccama.com/questions/651 and add a column assigner step after the ‘word split on semi colon’ step to append the string ‘query -’ followed by a sequence generator method. A sample expression would be:

Output would look like this:

 

 


Forum|alt.badge.img
  • Author
  • Space Explorer
  • October 22, 2024

Thanks for your response, is there a way to reset sequence generator by grouping a separate column like this

My json file contains input like this

 

Assessment Name

Query

Output expected

1000151- DM Asesment

Select * from emp1;select * from emp2

100151- DM Assement – Query - 1
100151- DM Assement – Query - 2

1000152 – DM Assessment

Select * from customer1;select * from customer 2

100152- DM Assement – Query - 1
100152- DM Assement – Query - 2

100153 – DM Assessment

Select * from order1;select * from order 2

100153- DM Assement – Query - 1
100153- DM Assement – Query - 2

 

Output generated is

100151- DM Assement – Query - 1
100151- DM Assement – Query – 2

100152- DM Assement – Query - 3
100152- DM Assement – Query – 4

100153- DM Assement – Query - 5
100153- DM Assement – Query - 6

 


ivysakh
Space Explorer
Forum|alt.badge.img+3
  • Space Explorer
  • Answer
  • October 23, 2024

Hi @rajeswarimyla ,

You can achieve this by adding an expression that will use the running sequence and a grouping step. Updated component is attached herewith.