4 Replies Latest reply: Nov 15, 2010 6:57 AM by weishuiqiufeng600 RSS

    Markup qvd

    weishuiqiufeng600

      Hello,

      Is there a markup or a field in the file qvd that can indicate from which qvw this qvd is created?

       

      Thanks

       

      Kai

        • Markup qvd
          Miguel Angel Baeyens de Arce

          Hello Kai,

          You can create that using functions DocumentPath() and DocumentName() which will return the path where the QVW file is stored and the name of the QVW file. Adding this to the tables you store you can identify which QVW created which QVD files.

           

          Table:LOAD *, DocumentName() AS SourceFROM File.qvd (qvd); STORE Table INTO File.qvd;


          Hope this helps

            • Markup qvd
              weishuiqiufeng600

              Hello Miguel,

              Yes, that is exactly what I did. However, in my system, a qvd may be used by another qvw to create another qvd. Then an error 'Field names must be unique within table' is generated since the table contains already the field 'Source'.

              Best wishes,

              Kai

                • Markup qvd
                  Miguel Angel Baeyens de Arce

                  Hello Kai,

                  Then you have to analyze which of the QVW you want to have. If they are a fixed number (say 3) you can create Source1, Source2 and Source3 fields, one for each of the QVW files, so at least one of them will always be populated.

                  Another option is using a preceding load (the Plain files button in the script editor window) will help so instead of using LOAD * you will have all fields loaded, and you will change the actual Source by the new field you create.

                  Say the file File1.qvd has the following fields: ID, Amount, Source. Your load script will look like

                   

                  File1:LOAD ID, Amount, SourceFROM File1.qvd (qvd);


                  Then, modify it to look like

                   

                  File1:LOAD ID, Amount, DocumentName() AS SourceFROM File1.qvd (qvd);


                  Hope that helps