Bitmetric Friday Qlik Test Prep – Week 9 – Statements & Breakpoints – Solution

By Bitmetric Admin

Every Friday at Bitmetric we’re posting a new Qlik certification practice question to our LinkedIn company page. Last Friday we asked the following Qlik Data Architect certification practice question:

No alt text provided for this image

Most people who replied had the wrong answer. This is very likely caused because a very important detail was omitted in the phrasing of the question. This wasn’t intentional, just hastily written. Sorry!

A Data Architect wants to use the debugger to set a breakpoint on a comment. Which format should be used to ensure that the debugger actually pauses on the comment?

Does this rephrasing change the answer you would’ve given? And is it the correct answer? Let’s see:

The correct answer is C: REM Breakpoint;

At the heart of this question are three things that you need to be aware of:

  1. Qlik Sense and QlikView come with a built-in debugger.

  2. Breakpoints in the debugger can only be set on a statement, not on a comment.

  3. The REM statement can be used to insert comments into the script.


Let’s look into these a little more.

Qlik Sense and QlikView come with a built-in debugger

A debugger is a tool that lets you test and debug your programs by letting you inspect the flow and state of your program while it is running. Debuggers are available for almost every programming language, often included as part of an IDE.

Both Qlik Sense and QlikView come equipped with a built-in debugger. In Qlik Sense it can be found here in the Data load editor:

Where to find the Qlik Sense debugger

In QlikView it can be found here in the Script editor:

No alt text provided for this image

Features included in both debuggers are:

  • Limited load, the option to only read a limited number of rows in LOAD statements. When dealing with large data volumes this can make test-runs much quicker as only a subset of the data will be loaded (typically 100 or 1000 rows). While convenient, a Limited load can also introduce errors because of non-matching data. We’ll cover this (and the debugger) in more detail another time.

  • Step-through, executing the script one statement at a time, pausing after every statement. This gives you the opportunity to see which branches in the code are being executed (in the case of conditional logic) and also which values the variables hold at that particular step in the script.

  • Breakpoints, places in the script where the script will be intentionally paused so that we can inspect the current state. Breakpoints are denoted by a dot next to the line number in the script:

No alt text provided for this image

Breakpoints in the debugger can only be set on a statement, not on a comment.

In Qlik Sense, a breakpoint is set by clicking next to the line number in the Data load editor. In QlikView, this is done by clicking net to the line number in the Debugger window.

No alt text provided for this image

As you can see in the animation above, Qlik let’s you set breakpoints wherever you want. Comments, statements, functions, white space, it doesn’t matter.

Except it does!

When using the debugger, the script will only be paused on breakpoints that are set on a script statement. To illustrate:

No alt text provided for this image

In the animation above, we’ve set breakpoints on line 1, 3, 5 and 7. When we run the script, in the debugger, we see that the breakpoints on lines 1 and 3 are skipped. This is because they do not contain a script statement and are therefore ignored by the debugger.

The REM statement can be used to insert comments into the script.

Line 5 contains a script statement (REM) so that’s why the debugger pauses there.

Wait a minute! The debugger also pauses on line 7!

The keen observer will note that the debugger also pauses on line 7. This is because Qlik doesn’t recognize — Breakpoint, assumes it’s a unknown statement and pauses. As — Breakpoint isn’t a valid Qlik statement, the script breaks when we resume the execution.

That being said, the debugger does pause on — Breakpoint so those of you who picked answer D are technically correct. Some say this is the best kind of correct, though it’ll probably not get you any certifications 😉

So REM is only useful to set a breakpoint in the debugger? Boring! I’ll just use // and /* */

Setting breakpoints on comments is probably not an everyday requirement, but there is a place where REM is superior to // and /* */ : to remove entire statements.

REM removes everything until it finds a semicolon. This means that you can use it to remove entire statements with a single comment. For example, the REM statement on line 2 in the image below comments out all the code up to and included the semicolon on line 13.

No alt text provided for this image

Compared to the alternatives (see below), it’s a bit faster to write, though arguably harder to read as REM doesn’t seem to be a commonly used statement.

No alt text provided for this image

Anyway, there you have it, an answer that’s quite a bit longer than it needed to be to a question that probably should’ve been a bit more verbose 😉

We look forward to seeing your comments and hope to see you again next Friday!

While you’re here anyway….

Just a reminder that we have a webinar for PinIt for Qlik Sense on March 17th. With PinIt, everyone can get an immediate, integrated overview of the metrics that matter to them. We do this by letting you combine visualizations from all your Qlik Sense applications into personal mashups (or “pinboards”). There is no code, and no hassle. Register for the webinar here.

Also, after 2 years of virtual sessions, the Masters Summit for Qlik is back with live events this fall. In September we’ll be in Madrid, Spain, and in November we’ll be in New Orleans, USA. If you want to take your Qlik skills to the next level, get access to all sorts of ready-to-use solutions and reference materials, share experiences and maybe a few horror stories with your peers then we hope to see you there

No alt text provided for this image


Previous posts

Week 8: Sales & Budget model

Week 7: MonthEnd(Today())

Week 6: Looping Tables

Week 5: Set Identifiers

Week 4: Time series visualization

Week 3: Circular References & Synthetic Keys

Week 2: Section Access

Week 1: Optimized Load

About The Author

Bitmetric Admin

Blog posts from the Bitmetric team. At Bitmetric, Qlik is what we do. We've been doing it for years, and we can do it for you! ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

Read previous post:
Bitmetric Friday Qlik Test Prep – Week 8 – Sales & Budget model – Solution

Every Friday at Bitmetric we're posting a new Qlik certification practice question to our LinkedIn company page. Last Friday we asked...

Close