Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
citrods
Contributor
Contributor

Split an input file into many output files (I'm blocked with tReplicate because I have to many replications) - Can I create an iteration?

Hello

I need to split a file into many many many files in order to do what I want to do.

I have an input file which looks like this

0693p00000BX0N2AAL.png

It covers the last 30 years.

Let's say I want to have a file which gives me the best 2 sellers for each year over the last 30 years.

My idea is to split the into file into 30 files (one fiche for each year.

Then for each file, I can sort them and selec the best two.

Then I can unite them in one file.

If apply this idea, i have o use "tReplicate" 30 times.0693p00000BX0NCAA1.png

If my input file cover the last 50 years, it won't work

How can I do to selectthe best 2 sellersof each year?

Is there another way?

Labels (2)
2 Replies
David_Beaty
Specialist
Specialist

Hi,

 

Yes, you'll need to use the tFlowToIterate component. Broadly:

 

tFileInputExcel -> tUniqRow (get unique years) -> tFlowToIterate ->

 

tFileInputExcel -> tFilterRow (get all rows for given year) -> tSortRow (order by # sales) -> tFilterRow (advanced flter - only get top 2 sellers) -> tFileoutputExcel

 

Thanks

 

David

 

If you find these answers helpful, don't forget to Like and/or set as the answer

citrods
Contributor
Contributor
Author

hello,

thank you, it almost work.

I wasn't able to perform this task:

tFilterRow (advanced flter - only get top 2 sellers)

 

how do you write the expression to the top 2 sellers?

Do you need to write in java?