3 Replies Latest reply: Feb 3, 2018 1:51 AM by Kaushik Solanki RSS

    Limit on If conditions

    Kaushik Solanki

      Dear Members,

       

      Recently I faced one strange issue.

      I had a Qlik Sense setup with version 3.2

      On this version we had developed one application which was having some conditional statements, like If.

      One of the If statement had 150+ more conditional statements, which was working fine.

       

      Later we upgraded the Qlik Sense to version June 2017 patch 3.

      Immediately after that the If statement with 150+ conditions started giving error.

       

      I checked the script and there was no change made in script.

       

      I tried so many things but couldn't find the reason, then one such testing I thought of this limit and

      to confirm this I commented couple of statements and made the count below 150 and it worked.

       

      Does anyone has encountered this behaviour before.

      Does anyone has any workaround for this situation?

      Does anyone know about such limitation? There is no article or any info available at the moment.

       

      Thanks

       

      Regards,

      Kaushik Solanki

        • Re: Limit on If conditions
          Massimo Grossi
          Does anyone has any workaround for this situation?

           

          maybe you can split the if conditions in 2 groups

          this is an over simplified example with a limit of 4 if

           

          Load

               f1,

               if(f1 = 5, 'e',

               if(f1 = 6, 'f',

               if(f1 = 7, 'g',

               if(f1 = 8, 'h',

               f2

               )))) as f2

          ;

          Load

               f1,

               if(f1 = 1, 'a',

               if(f1 = 2, 'b',

               if(f1 = 3, 'c',

               if(f1 = 4, 'd',

               f1)))) as f2

          ;

          LOAD * Inline [

          f1

          1

          2

          3

          4

          5

          6

          7

          8

          ];

          • Re: Limit on If conditions
            Marcus Sommer

            I do expect such a limitation. Within the earlier QlikView releases there was a limit of 99 nested if-conditions and in my opinion it's a useful restriction to ensure stability. I think within the newer releases of QlikView and Qlik Sense there are furthermore limitations to n nested if's - maybe they are higher now and there might be also one or two releases where this limitation wasn't wrongly enabled.

             

            Beside this I believe that there are other/better ways to construct a query with many conditions than with nested-if's. For instant the example from Massimo here could be easily handled with a pick(match()) solution.

             

            - Marcus