Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am new to qlikview and have a kind of situation where my expressions are having more than 10 nested if conditions, thus charts are taking hell lot of time to open. All ifs' are result of the multiple filters provided in dashboard.
Please suggest me some other way round to decrease the opening time of charts.
Regards,
Navdeep Kumar
It depends on how your ifs are structured. There are other functions such as pick() that can be used together with for example match().
Can you show us how the ifs look like?
Few suggestions:
1. Use if...else statements in the load script and not in the expression of a chart.
2. See if you could utilize peek(). interval match(), group by functions.
Remember if..else is memory and CPU intensive so you should always use them in the load script and avoid using in expressions whenever possible.
Hi,
best you provided sample data/app to get specific answers to your question.
regards
Marco
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
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”:
If you want to add an additional if-clause just click on “Add another IF-block”:
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:
Now the last step is easy, change to the “Generated Code” tab and copy your code:
The Tool is offering three different “Formatting Styles”:
If-statements formatted like this were the main-reason for creating this tool
This is my preferred formatting-style for really large if-statements with complex conditions
This is my preferred formatting-style for if-statements with short conditions like demonstrated in this example …
Have fun
Hi,
Thanks for your valuable time. It is something like that..
if(GetFieldSelections(vA)='Local Currency',
if(GetFieldSelections(vB)='Include',
if(GetFieldSelections(vC)='Include',
.
.
.
then few more if conditions under each of them.
Conditions are based on user selection.
Please let me know the other way round and I will definetly explore pick and interval match().
Regards,
Navdeep
Thanks Bomma,
But here my problem is something different. I want to avoid Ifs, but as all are getting calculated on the fly bcz of GetFieldSelections(). Is there any way to reduce them ? if yes, thn plz guide me.
Regards,
Navdeep
Hi,
Waiting for the solution. Appreciate some help here.
Hi,
Attach full expression.
Regards,
Jagan.