Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
Peter, AFAIK short circuit evaluation doesn't happen in Qlik
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.