Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello i need a statement different from for next, what can i use?
Thanks
Marco
You can loop with statements in a control statement like with:
DO WHILE i<10
i = i + 1;
LOOP;
or
DO
i = i + 1;
LOOP WHILE i<10;
but you can use a loop inside a LOAD statement which gives an order or several order of magnitudes faster looping:
SomeRows = Ceil( Rand() * 100 ) + 100;
DATA:
LOAD
RowNo() AS RowNo,
IterNo() AS IterNo
WHILE
IterNo() <= 10
AUTOGENERATE
$(SomeRows);
And as you see from the above example you can also use AUTOGENERATE to "loop" a certain number of times.
Depends what you are trying to do..... maybe while ?
But while exists as statement? Which is the syntax?
Thanks
Marco
The QV Desktop Help is very good and explains it in detail.
And as I said, it depends what you are trying to do....your question was a trifle vague.
You can loop with statements in a control statement like with:
DO WHILE i<10
i = i + 1;
LOOP;
or
DO
i = i + 1;
LOOP WHILE i<10;
but you can use a loop inside a LOAD statement which gives an order or several order of magnitudes faster looping:
SomeRows = Ceil( Rand() * 100 ) + 100;
DATA:
LOAD
RowNo() AS RowNo,
IterNo() AS IterNo
WHILE
IterNo() <= 10
AUTOGENERATE
$(SomeRows);
And as you see from the above example you can also use AUTOGENERATE to "loop" a certain number of times.
The QV Desktop Help is not working on my version, so i ask in this forum.
Thanks
Marco
do while | until condition
statements
loop
or
do
statements
loop while | until condition
See the article on do...loop in QV Desktop Help
syntax is, copied from QV Desktop Help
The do..loop control statement is a script iteration construct which executes one or several statements until a logical condition is met. The syntax is:
do[ ( while | until ) condition ] [statements]
[exit do [ ( when | unless ) condition ] [statements]
loop[ ( while | until ) condition ]
Where:
condition | is a logical expression evaluating to true or false. |
statements | is any group of one or more QlikView script statements. |
The while or until conditional clause must only appear once in any do..loop statement, i.e. either after do or after loop. Each condition is interpreted only the first time it is encountered but is evaluated for every time it encountered in the loop.
If an exit do clause is encountered inside the loop, the execution of the script will be transferred to the first statement after the loop clause denoting the end of the loop. An exit do clause can be made conditional by the optional use of a when or unless suffix.
Since the do..loop statement is a control statement and as such is ended with either a semicolon or end-of-line, each of its three possible clauses (do, exit do and loop) must not cross a line boundary.
Examples:
// load files file1.csv..file9.csv
Set a=1;
Do while a<10
Load * from file$(a).csv;
Let a=a+1;
Loop
Reinstall QV Desktop.
or
consult the QlikView Reference Manual in C:\ProgramData\QlikTech\QlikView Documentation\Reference Manual. It contains the same and much more as QV Desktop Help.
Peter
Thanks.
Marco