Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
shumailh
Creator III
Creator III

Can we read qvw file by using another qvw?

Can we read qvw file by using another qvw?

Regards,
Shumail

20 Replies
Not applicable

Hi Paul,

Adding some more about qvd's, instead of just creating qvd file for source data we can also append data in qvd files.

Multiple qvd's can be used in the same qvw file(no need of connectivity to data base)

Qvd for Inline can also be created and can be used in other qvw files.

Regards,

Mohit

johnw
Champion III
Champion III


Mohit.... wrote:how can we read one qvw file into another qvw file, coz using binary command we can just import one qvw file?


I'm not sure I understand the question, since you answer it yourself. To read one qvw file into another qvw file, you use the binary command. Yes, you can only import one qvw file using the binary command. I almost always use QVDs instead of binary loads.

Not applicable

John,

Actully i want to know is there ne way to use more then one qvw in A qvw file?

johnw
Champion III
Champion III


Mohit.... wrote:Actully i want to know is there ne way to use more then one qvw in A qvw file?


Either I don't understand the question, or we're going in circles. NO, you cannot use more than one qvw in a qvw file. You can only use one qvw in a qvw file:

"you can have only one binary statement in your script so you cannot create separate qvw for every source table."
"You can only have one binary load, and it must be the first statement in your script."
"Yes, you can only import one qvw file using the binary command."

Not applicable

Thank you!

Not applicable

this means i can't use like this?

qvw1 -> binary qvw1 + qvw2-> binary qvw2 + qvw3....

^^ just wondering.

johnw
Champion III
Champion III


Muncho wrote:this means i can't use like this?
qvw1 -> binary qvw1 + qvw2-> binary qvw2 + qvw3....
^^ just wondering.


Correct. You cannot do that. However, Rob Wunderlich gives a nice solution in this blog post:

http://qlikviewnotes.blogspot.com/2011/02/qvd-questions-and-answers.html

To get right to the part of interest, you can add this code at the end of the script in each of the QVWs you wanted to binary load, and it will output EVERY table in each QVW to a QVD. Then just load all of the tables from the QVDs, just a bunch of "[Table Name]: LOAD * FROM Table Name.qvd (QVD);". That will have the same effect, if with a bit more complexity. And since they're all optimized QVD loads, it'll still load quite quickly. I'd probably strip out the spaces or replace with underscores when making the QVDs, though, since some things don't deal well with spaces in file names. To simplify the load side even further, you could probably store all the QVDs to a directory specific to your application, and then loop to load all QVDs in that directory, though I haven't tried to work out the details.

FOR i = 1 to NoOfTables()
LET vTableName = TableName($(i)-1);
LET vOutfile = '$(vTableName).qvd';
STORE [$(vTableName)] INTO [$(vOutfile)] (qvd);
NEXT i

dmohanty
Partner - Specialist
Partner - Specialist

Hi John,

I was just implementing the above said logic (also from Rob's post) in one of my requirement. I used exactly the same code and logic to generate QVDs. But in this case some of the tables are stored into QVDs and rest are showing "Table Not Found" error. Does the above code works perfectly? I used them to store Inline tables as well. But I failed to do so. Can you please help? Below is the code of my requirement. Here I have 4 QVDs in each folder. 2 are getting stored and 2 are showing  "Table Not Found" error.

Let qvdpath = 'C:\Users\XYZ\Desktop';

For Each qvd_file in FileList('$(qvdpath)\MAP_1\*')

         let QVDName = subfield('$(qvd_file)','\',6);

          

          $(QVDName):

          LOAD *

          FROM [$(qvdpath)\MAP_1\$(QVDName)] (qvd);          

Next

For Each qvd_file in FileList('$(qvdpath)\HPG_1\*')

          

          let QVDName = subfield('$(qvd_file)','\',6);

          

          If Alt(NoOfRows('$(QVDName)'),0) > 0 Then

                    Concatenate($(QVDName))

                    LOAD *

                    FROM [$(qvdpath)\HPG_1\$(QVDName)] (qvd);

 

          Else

                    $(QVDName):

                    LOAD *

                    FROM [$(qvdpath)\HPG_1\$(QVDName)] (qvd);

          End If

Next

For i = 1 to NoOfTables()

         

          Let vTableName =  TableName(i);

          Let vOutfile = vTableName ;

STORE '$(vTableName)' INTO '$(qvdpath)\Test QVDs\$(vOutfile)' ;

Drop Table '$(vTableName)';

Next i

EXIT Script ;

:

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The problem is that you are Dropping the table as you store it, thereby changing the list of tables, so TableName(i) does not work correctly. The solution is to work list of tables backwards like this.

FOR i = NoOfTables()-1 to 0 step -1

          LET vTableName = TableName($(i));

          LET vOutfile = '$(vTableName).qvd';

          STORE [$(vTableName)] INTO [$(vOutfile)] (qvd);

          DROP TABLE [$(vTableName)];

NEXT i

-Rob

http://robwunderlich.com

dmohanty
Partner - Specialist
Partner - Specialist

Hey Rob, You are a wizard. That's working perfectly, how I wished to. Thanks a zillion in helping out where a single line was creating issue. I was knowing that DROP was creating problem, but was not sure how to fix it.

Hats Off to you again.

Regards