4 Replies Latest reply: Feb 8, 2018 10:19 AM by Marcus Sommer RSS

    Load from QVD with wildcards

    Tobias Stolpe

      Hello everybody,

       

      I am trying to load data from QVD-files with wildcards.

      Image I have the following QVD's

      • File_1.qvd
      • File_2.qvd
      • File_3.qvd

       

      I know about the wildcard "*" | "?" to load multiple files.

       

      [Example to load all Files]:

      Load *

      FROM [lib://Folder/File_*.qvd] (qvd);

       

       

      But how can I define to load just 2 Files (File_2.qvd & File_3.qvd) with a specific syntax?

      Does Qlik supports other wildcards or even regex for load statements?

      Or is the only possibility to loop and check with "Wildmatch" for my wanted files? What is really nasty.

       

       

      Regards

      Tobias

        • Re: Load from QVD with wildcards
          max payne

          why don't you try with for each

           

          like below

           

          for each a in 1,3,7,'xyz' LOAD * from file$(a).csv; next

           

          for more details see in help menu.

          For each..next ‒ Qlik Sense

           

          Regards,

            • Re: Load from QVD with wildcards
              Tobias Stolpe

              I was also thinking about that solution, like I described above.

              But the Problem here is, I have to know before hand what file names I want to load.

              If the file is not found, the script returns an error.

               

              I want to do it over different kind of files and and I do not know every combination before hand.

              Furthermore I want to build the names on the fly, because I want to use it in a script for On Demand App Generation.

               

              Of course I could search in a folder, match the findings with my pattern and loop trough every combination, but this script gets nasty and blown up for a simple regex expression.

               

              I have some solutions I could work with but my question, when Qlik supports wildcards, does they also support further Wildcards as * which are not documented yet???

               

                • Re: Load from QVD with wildcards
                  max payne

                  does they also support further Wildcards as * which are not documented yet???

                       > I am also new in QlikSense so not sure about it.

                   

                  I am still not getting your question. You are making 2 contradict statement.

                  In your original post you are saying that you want file_2 & file_3.qvd and

                  In You are earlier reply you are saying You want solution where you don't have file name in your hand before load.

                  ?

                  ?

                  ?

                   

                  So how qlik understand which file to load or which not??

                   

                  Another logic in my mind is If you dont have file in your hand before load or you don't want to update it in script.

                   

                  Then You can try below logic

                  1: Maintain excel file where you insert filename which you want to load

                  2: Load excel in script & use that column in for loop.

                   

                  Regards

                  • Re: Load from QVD with wildcards
                    Marcus Sommer

                    I don't think that there are further wildcards available and that you could apply any regex-logic by loading files. I'm not absolutely sure but I believe that Qlik has no own logic for handling files else they just use windows dll's for it and AFAIK there are also only * and ? as wildcards defined.

                     

                    Beside this I don't think that a for each approach with dirlist/filelist is ugly. It's fast and quite often there are further conditions like checking the filetime/filesize, handling different data-structures, file-formats, where-clauses and so on - and at least there you will need some more efforts to implement it.

                     

                    Further the help-example for the loop indicates by using sub-routines how it could be nicely handled - means putting everything in a routine which again called the necessary routines and this could be put in an include-variable and used globally within your whole environment. And then its just enough to call the routine with the needed parameters.

                     

                    - Marcus