4 Replies Latest reply: May 26, 2014 10:10 AM by augustin peyridieux RSS

    concatenate in a loop

    Paolo Rena

      Hi to all,


      Is possible to generate a loop of concatenate, that concatenate the content of some qvd’s files?


      Will follow an example:

      Suppose that I have a field in my database that is:

      FIELD: {A,B,C,D}


      And suppose that I have 4 qvd’s file:

      - fileA.qvd

      - fileB.qvd

      - fileC.qvd

      - fileD.qvd


      I need to find a way to generate an automatic iteration that generate code like the one below:

      Load *

      from  fileA.qvd


      Load *

      from  fileB.qvd


      Load *

      from  fileC.qvd


      Load *

      from  fileD.qvd


      Can you give me an example of concatenate in a loop?


      Set NFiles = 4;
      for i = 1 to $(NFiles-1)




      In this sample there are 4 files. In my final qvw will be more than 100 qvd that will be concatenated.

      So I need to find a script that generate automatically the concatenate of those files.


      Thank you for supporting me.


        • Re: concatenate in a loop
          Gysbert Wassenaar

          That sounds like a very bad idea. Your table will look like this:


          A     B     C     D

          3     -     -     -

          4     -     -     -

          1     -     -     -

          -     1     -     -

          -     5     -     -    

          -     2     -     -    

          -     -     3     -    

          -     -     1     -

          -     -     6     -

          -     -     -     2

          -     -     -     1

          -     -     -     2




          If that's really what you want try this:



          LOAD * INLINE [A];


          FOR EACH vFile in FileList('C:\QVDATA\*.qvd')


                      LOAD * FROM [$(vFile)] (qvd);

          NEXT vFile

            • Re: concatenate in a loop
              Paolo Rena

              Hi Gysbert ,

              thanks a lot, works perfectly.

              I know that is a bad idea but i think is the only one possibility to concatenate qvd's.

              1. The loading will be from one table that contain all the datas. (qv_file: LOAD * FROM Table where code = var)

              2. With multi-tasking scheduling we run many task of the same qv_file with a parameter (variable).

              (in a command line will be: run qv_file /vvar=001,

              in another command line will be: run qv_file /vvar=002



              In this way we got all the data filtered with this variable, to have many qvd's that are called with a name of such variable. (qv_file_001.qvd, qv_file_002.qvd......)


              Like that we can run so many task of the same file in parallel (that is not possible to have the same parallelism using QV server)


              After that, in the front end all the qvd's will be concatenated together! And that was my question.


              Do you have another idea for such topic, and about the concatenate? Your idea work so good, but maybe is not good with many datas.


              Thank you, have a nice day!