4 Replies Latest reply: Sep 29, 2014 5:31 PM by Peter Kormos RSS

    reloading a previously (from multiple files) created .qvd

      Hello everyone,

       

      after trying 10 different ways (straight load, concatenate, dummy field autogenerate, loop and left join, for each loop and concatenate etc..) I managed to load and store multiple txt files with analog names and wildcard into a single qvd. (actually with every solution I tried). So far so good.

       

       

      Now after dropping the main table (consisting of  auto concatenated txt files) I would like to reload the freshly stored qvd.

       

      If I do that I am only able to load the very first txt file from the multiple txt files I merged into one qvd.

       

      If however I exit the script after dropping the table then load the new merged qvd in a new load I receive the result I desire.

       

      Can any of you explain why this happens and whether I can work around this mistique?

       

       

      thank you for your help in advance

      Peter

       

       

      ps: here is my code:

       

      (like I wrote, I need to reload the script twice and change the variable from 0 to 1 the second time)

       

      IF $(ScriptRunner)=0 then

           TempLoad: LOAD * FROM [C:\Users\Statusreport_*.txt] (txt, codepage is 1252, embedded labels, delimiter is ';', msq)

           ;

           STORE TempLoad INTO [C:\Users\all_txt.qvd] (qvd)

           ;

           DROP TABLE TempLoad;

           EXIT SCRIPT

      ELSE

           test: LOAD* FROM [C:\Users\all_txt.qvd] (qvd)

           ;

      END IF

      EXIT SCRIPT

        • Re: reloading a previously (from multiple files) created .qvd
          Jonathan Poole

          Maybe the QVD hasn't finished writing to disk when the read (from the freshly created QVD) takes place ?

           

          There is a sleep <milliseconds>;  command that you can try to pause the script for a longer period.

           

          If you add a sleep for 30000 milliseconds right after the STORE command does it work better ? If you use the DEBUG option to step line by line through the code do you notice if the QVD is fully written once it steps to the line of code right after the STORE ? or does the QVD still continue to get written as the code progresses ?

           

          Not 100% sure but these test may help.

            • Re: reloading a previously (from multiple files) created .qvd

              Hello Jonathan,

              I cannot see the line where it stores the qvd at all if I load right after writing the dvd.

              I just tested sleep as well but without exiting the script it does not seem to be able to store the qvd properly..

               

               

              no store executed.PNG.png

               

              next line after that is following:

              next line in debugger.PNG.png

                • Re: reloading a previously (from multiple files) created .qvd
                  Jonathan Poole

                  It does seem strange. If you copy/paste into a new app (QVW) do you see exact same behavior ?

                   

                  Maybe try setting a dummy variable on the line right after the store. when you step to that line (right after the QVD), do you notice (outside of the script) that the QVD gets fully written ?  Just wondering if it needs an extra script command (anything) to flush it through... although none of this is very expected hence the 'try it somewhere else' thing above.   I also want to review the code before since unexpected table concatenation or lack of can happen easily as well... but that doesn't explain why the qvd write works fine if you exit script first (unless its flushing something through).  Not sure but let me know what happens !

                    • Re: reloading a previously (from multiple files) created .qvd

                      Hello again,

                       

                      I tried extra code, debugging, concatenate works just fine, but I need to exit the script. Also the first load that concatenates the txt files into one qvd needs to be an optimized qvd. So no extras like filenam() or preceeding load. Just renaming and reformatting dates allowed.

                       

                      If you (or someone else) have another idea pleas share.

                       

                      Thanks for your input anyway and good night (as it is 23:30 here and i am an early bird..)

                       

                      bests Peter