Questions about QlikView Loops

Source: Internet
Author: User
Problem description: after checking the help of QlikView, you can see the loop Syntax of QlikView, as shown in the following Code: LETvTest11; LETvTest230; DOWHILE (vTest1 $ (vTest2) LETvTest1 $ (vTest1) + 1; LOOP, however, is puzzling about how to replace DOWHILE (vTest1 $ (vTest2) with the following method and then become an endless LOOP.

Problem description: after checking the help of QlikView, you can see the loop Syntax of QlikView, as shown in the following Code: LET vTest1 = 1; LET vTest2 = 30; do while (vTest1 $(vTest2 )) LET vTest1 = $ (vTest1) + 1; LOOP, however, it is puzzling why do while (vTest1 $ (vTest2) is replaced with the following method and then becomes an endless LOOP.

Problem description:

After reading the help of QlikView, you can find out the loop Syntax of QlikView, as shown in the following Code:

LET vTest1 = 1;LET vTest2 = 30;DO WHILE (vTest1 < $(vTest2))LET vTest1 = $(vTest1) + 1;LOOP
However, it is puzzling why do while (vTest1 <$ (vTest2) is replaced with the following method and then becomes an endless loop:

Do while ($ (vTest1) <$ (vTest2 )).

Google does this many times, but it only means that the while condition will be compiled once, and all values in the loop will be parsed in each loop.

The original article is as follows: Each condition is interpreted only the first time it is encountered but is evaluated for every time it encountered in the loop.

Therefore, the above condition becomes so that do while (1 <30) remains valid.

Solution:
1. DO not use dollar sign in the while condition, such as do while (vTest1 <$ (vTest2 ));

2. Use exit do when in the loop statement as follows:

LET vTest1 = 1;LET vTest2 = 30;DO WHILE ($(vTest1) < $(vTest2))LET vTest1 = $(vTest1) + 1;EXIT DO WHEN ($(vTest1) >= $(vTest2));LOOP
Question:
Why does QklikView only compile conditions once?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.