A little tool for creating nested if-statements

Nested If-statements are sometimes necessary in QlikView- load-scripts, unfortunately.
They are quite difficult to read and very tricky to create and especially to debug.

In the last recent months I had a lot of projects where a tenfold nesting of if-statements was not uncommon.

After struggling with these nested ifs for a while I decided to create a little user-interface which helped me to decrease the time for creating nested if-statements.
Even if this tools is just a little, little helper it may also be helpful for you, so I decided to publish it here:

Try the “Nested If Generator” now

Some screenshots and explanation:

At the beginning you can define the “fieldname” to be generated” and define your first if-statement:
Let’s assume you are checking the two fields “Age” and “Profession”:

Defining the first if-statement

Defining the first if-statement

If you want to add an additional if-clause just click on “Add another IF-block”:

Adding a second if-statement

Adding a second if-statement

As you can see when comparing the two screenshots above the “else-block” of the first statement was removed and replaced by an additional if-clause.

After some further if-blocks the configuration could look like as follows:

After adding several if-statements

After adding several if-statements

Now the last step is easy, change to the “Generated Code” tab and copy your code:

Generated Code to be used in QlikView

Generated Code

The Tool is offering three different “Formatting Styles”:

Single line formatting

Single line formatting

Single line formatting

If-statements formatted like this were the main-reason for creating this tool :)

Indent style with one line per condition

Indent style with one line per condition

Indent style with one line per condition

This is my preferred formatting-style for really large if-statements with complex conditions

Indent style with one line per if-statement

Indent style with one line per if-statement

Indent style with one line per if-statement

This is my preferred formatting-style for if-statements with short conditions like demonstrated in this example …

Have fun :)

Bookmark and Share

and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

66 Comments

  1. Posted July 26, 2014 at 20:23 | Permalink

    There are rare fumes from electronic cigarettes, and that enables a smoker to
    smoke safely to puff a cigarette even frankly in front of the family
    members or children. The TGS-813 is basically a sintered type of semiconductor primarily made up of tin dioxide (Sn – O2).
    The first thing you do with an electronic cigarette starter kit
    is to charge up the charger pack, then you use the charger pack to charge up the battery
    in the electronic cigarette.

  2. Posted July 28, 2014 at 03:03 | Permalink

    This article will help the internet people for
    setting up new web site or even a blog from start to end.

4 Trackbacks

  1. By Nested if-statements tool on January 11, 2010 at 12:14

    [...] You can check it out here [...]

  2. [...] Possibly related posts:A little tool for creating nested if-statements [...]

  3. By So I’m back … | qlikblog.at on February 1, 2011 at 03:10

    [...] QlikViewQlikView Publisher/ServerPublishing more tools for the daily work with QlikView like the “Nested if-generator tool”, which is used by visitors of qlikblog.at more than 100-times used a day (!!!!)QlikView APIsRelated [...]

  4. By Set Analysis Wizard « QlikView – My View on March 6, 2012 at 02:37

Post a Comment

(required)
(required)

Your email is never published nor shared.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting