Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jblomqvist
Specialist
Specialist

Hello, can I please have some examples of using Loops in QlikView to understand how/when to use them? E.g. For, Next statements?

Hello,

I am trying to learn about how to use Loops in QlikView.

I read this blog post Loops in the Script but I did not fully grasp it.

Can anyone please show me practical examples of how to use Loops in a QlikView application? E.g. for analysing data or to load data?

Thank you

2 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi John,

allow me to refer you to my book, QlikView Your Business. The book offers numerous examples and exercises on using loops for various solutions in QlikView. Here is one example from the book. In the following loop, we generate several variables with the date-related filters:

FOR EACH vFilter IN 'CYTD', 'PMTD', 'CMTD', 'PMTD', 'R12', 'PR12', 'R6', 'PR6', 'R3', 'PR3'

          LET vFilterName = 'filter_' & vFilter;

          LET vFilterDefinition = '_' & vFilter & '_Flag = {1}';

          SET $(vFilterName) = '$(vFilterDefinition)';

NEXT

Many other examples in the book demonstrate how to use loops to generate QVD files for all tables in a given SQL database or in a QlikView document and for other purposes.

cheers,

Oleg Troyansky

QlikView Your Business: An expert guide to Business Discovery with QlikView and Qlik Sense

Anonymous
Not applicable

hi john,

in addition please go thru qlikview help for Script control statements for understanding loops:

If..then..elseif..else..end if
For..next
For each..next
Do..loop
Switch..case..default..end switch
Exit Script
Sub..end sub
Call

search in the forum with above keywords.