Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
robynrshields
Contributor III
Contributor III

If Statements in script

I have a requirement where I'm using the following If statement in the load script.  I'd like to know if anyone has any suggestions to be more efficient.  Or is this the best way to do this?  Note that I have over 8 million records in this table.  Thanks in advance.

If( (practice = 'A' or practice = 'B') AND (Payer='1') AND ServiceDate < '01/01/2000', 'code1',
If( v75_svcSortName = 'C', 'code2'

If(( practice ='A' or practice = 'B' or practice =’D’) AND (Payer ='2') AND  ServiceDate < '01/01/2005', 'code3', ‘other’ )))  AS BillingCode

 

 

12 Replies
robynrshields
Contributor III
Contributor III
Author

Thank you for the additional information about the sequential order in the If statements.  I will try that along with also testing the performance time with and without the If statements.

This 'If' statement is part of code that I use to create a QVD daily for all 8 million rows.  I know how to do incremental loads, but I'm not sure that in this case that an incremental load will benefit.

Thanks everyone for your input.

maxgro
MVP
MVP

Peter, AFAIK short circuit evaluation doesn't happen in Qlik

Re: help - performance improvements

View solution in original post

Peter_Cammaert
Partner
Partner

I must have been in a hurry to leave the office when writing that post. While driving home, I got all sorts of stinging thoughts about why that reasoning couldn't be correct. And when I got home I had a couple of strategies to make it work, in scripting at least.

I can't find a reason why this kind of optimization can't be used in scripting (even with those weird IF() functions). And the thread you are linking to only discusses valid reasons why it won't work in charts.

But... no it doesn't work in scripts either. The improvement from 2014 still hasn't happened.

Thanks for putting the record straight.