7 Replies Latest reply: Jul 23, 2014 9:14 AM by Friedrich Hofmann RSS

    LOAD statement - complex IF-construct as a variable

    Friedrich Hofmann



      in one of our primary loading apps, I have found an IF-construct (to define the working areas) that runs over eight lines ... to make the whole thing more resource-friendly and, more important, to avoid the risk of introducing slight differences when using the same code in another place, I want to try to create a variable for this expression and store it in a qvs file.

      So I tried as I normally do like

      >> LET e_formula = ' ... '; <<

      <=> That, however, did not work in this case. The formula of course contains a lot of blanks, so I tried enclosing the whole thing in square brackets like

      >> LET e_formula = '[ ... ]'; <<

      <=> but that didn't work, either. Moreover, there are a lot of text_strings which are enclosed in upper_quotes and it contains a lot of Wildmatch() functions with *.


      Can anyone give me a hint how I could get this to work?


      Thanks a lot!


      Best regards,



        • Re: LOAD statement - complex IF-construct as a variable
          sujeet Singh

          Try using trim() function of qlikview


          In order to remove  spaces

          • Re: LOAD statement - complex IF-construct as a variable

            Hi DataNibbler,


            I would put this code inside a .txt file and then simply call it everytime I would like to use it by using the include function.



              • Re: LOAD statement - complex IF-construct as a variable
                Friedrich Hofmann

                Hi Marius,


                that's exactly what I want to do. Is there a way to do this other than to put it into a variable?

                I have not been able to do that so far.

                Also, I would like to simplify the formula a bit, that would be more resource-friendly and  maybe then it would be easier to put it in a variable, too.

                Right now, as I said, it is an If-construct running over like eight lines, with WildMatch() functions - so I think I could not use PICK(WILDMATCH()) instead - there are several possible texts to match in every line which correspond to one area.

                I will post the code here. Maybe someone has an idea?




                if(WildMatch(PACK_DELIVERY_BIN,'*KT*','TIMEKT','AT*','WERTE RSML','XGTKT'),'KT',


                  if(WildMatch(PACK_DELIVERY_BIN,'*BT*','BTZW*','GT','GT1*','GT2','GT3','GT6','GT7','GTL*','GTR*','*FAST','*SLOW','GT ESD','GTXL','GT AIR'),'GT',








                            'Sonstige')))))))))) as Packplatz,