Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

For loop for Quarter

Hi,

I'm extracting a large amount of data from a SQL server database. There's a limit on the amount of data that can be pulled per query, so I need to query data quarter by quarter. I'm wondering if there's a for loop function in Qlikview load script that can automate this. So, I'm thinking something like.

For all quarters in current year and last two years

Data:

Load *;

SQL select *

From my table

Where mytable.quarter = quarter;

Concatenate  (Although there are several select queries , I would like to have data loaded in the same table in qlikview)

Next quarter.

Is it possible or any other suggestions?

Thanks

Yvonne

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

If your table contains identifiable quarters, dsignated with for example a string like Q1, Q2, Q3 and Q4 (or anything else you can enumerate), the na FOR EACH loop like this will do:

FOR EACH vQuarter IN 'Q1', 'Q2', Q3', 'Q4'

  Data:

  LOAD ... ; // Not needed when no field modifications

  SQL SELECT * FROM mytable WHERE mytable.quarter = '$(vQuarter)';

NEXT

QlikView will perform an AUTOCONCATENATE as soon as it detects similar loads.

Best,

Peter

View solution in original post

2 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

If your table contains identifiable quarters, dsignated with for example a string like Q1, Q2, Q3 and Q4 (or anything else you can enumerate), the na FOR EACH loop like this will do:

FOR EACH vQuarter IN 'Q1', 'Q2', Q3', 'Q4'

  Data:

  LOAD ... ; // Not needed when no field modifications

  SQL SELECT * FROM mytable WHERE mytable.quarter = '$(vQuarter)';

NEXT

QlikView will perform an AUTOCONCATENATE as soon as it detects similar loads.

Best,

Peter

Anonymous
Not applicable
Author

I think this can be useful for you

for loop in qlikview with dates