Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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.