Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Has anyone experienced the problem of tables that are saved out as qvd files with specified names and when loaded have the wrong table name.
I use the following code to store 4 tables with different names:
STORE Estimates INTO [lib://ExportQVDFiles/Estimates.QVD] (qvd);
STORE EA8 INTO [lib://ExportQVDFiles/EA8.QVD] (qvd);
Drop Tables Estimates,EA8;
STORE Exam INTO [lib://ExportQVDFiles/Exam.QVD] (qvd);
STORE ExamA8 INTO [lib://ExportQVDFiles/ExamA8.QVD] (qvd);
Drop Tables Exam,ExamA8;
When I load the first 2 qvd files back I get a name from the other QVD file (see below example). My understanding is the names should be derived from the file name if not specified. The fields are correct in the table but the table name is coming from the wrong QVD file.
LOAD
*
FROM [lib://ExportQVDFiles/Estimates.QVD] This names the table correctly as Estimates
(qvd);
LOAD
*
FROM [lib://ExportQVDFiles/EA8.QVD] This names the table incorrectly as ExamsA8 which is one of the QVD
(qvd); files but not this one.
"I would just add the table names to the sub routine. I think it is just how Qlik works with tables loaded, if not named it takes the One above add add -1 on the end."
Nope that is not how it works, read the thread below
Can you post the full script?
i think you have automatic concatenation going on!
Add NoConcatenate before each table load and try
example;
Load *
From XXX;
NOCONCATENATE
Load *
from xxx;
I am using the sub routines below to load the qvd files
Sub LoadQVD
NoConcatenate
LOAD
*
FROM [lib://ExportQVDFiles/Estimates.QVD]
(qvd);
NoConcatenate
LOAD
*
FROM [lib://ExportQVDFiles/EA8.QVD]
(qvd);
NoConcatenate
LOAD
*
FROM [lib://ExportQVDFiles/Exam.QVD]
(qvd);
NoConcatenate
LOAD
*
FROM [lib://ExportQVDFiles/ExamA8.QVD]
(qvd);
End Sub;
Sub Main;
LIB CONNECT TO 'ProgressTransitions';
//These 2 subroutines create the qvd files
Call EstimatesData;
Call ExamData;
//I put disconnect in to see if it was holding on to the sql tables but that doesn't work either
DisConnect;
Call LoadQVD;
End Sub;
Call Main;
HI,
I would just add the table names to the sub routine. I think it is just how Qlik works with tables loaded, if not named it takes the One above add add -1 on the end.
Sub LoadQVD
NoConcatenate
Estimates:
LOAD
*
FROM [lib://ExportQVDFiles/Estimates.QVD]
(qvd);
NoConcatenate
EA8:
LOAD
*
FROM [lib://ExportQVDFiles/EA8.QVD]
(qvd);
NoConcatenate
:Exam:
LOAD
*
FROM [lib://ExportQVDFiles/Exam.QVD]
(qvd);
NoConcatenate
ExamA8:
LOAD
*
FROM [lib://ExportQVDFiles/ExamA8.QVD]
(qvd);
End Sub;
"I would just add the table names to the sub routine. I think it is just how Qlik works with tables loaded, if not named it takes the One above add add -1 on the end."
Nope that is not how it works, read the thread below
OK I just did some testing on some dummy data
1) Loaded 2 inline tables
2) stored them in a qvd.
3) dropped the tables
4) immediately loaded the tables from QVD again
and surprisingly the second table loaded always retained the table name not the qvd, i think by the time it loaded the table Qlikview hadn't flushed out the table details automatically renamed the last table to be loaded from new qvd to the last loaded table
So All I had to do to fix this was add in a dummy table between dropping the tables and reloading from the stored QVD's again.
Example below
Fact2:
LOAD * inline [
FromID,otherfield
1,a
1,b
1,c
1,d
1,e
2,f
3,g
];
Fact1:
LOAD * inline [
FromID,ToID,Amount
1,1,3000
1,2,3000
1,3,4000
];
Store Fact2 into xxxxxxxx\fct2.qvd;
Store Fact1 into xxxxxxxx\fct1.qvd;
DROP table Fact1;
DROP table Fact2;
// Added temp table to cbreak the sequence//
temp:
load rowno() AutoGenerate(10);
load * from
xxxxxxxx\fct1.qvd(qvd);
load * from
xxxxxxxx\fct2.qvd(qvd); // << this table always retained name of last table loaded in memory , if you commen the //temp table load script you will see it gets renamed to Fact1
The Temp table will solve your problem
Hi Vaneeth,
I am not sure force concatenation is relevant here.
If I am understand the issue correctly, it is just down to tables being named incorrectly, not down to any concatenation.
So forcing the names to the table also solves the problem, using your example adding names as below
FACT1:
load * from
xxxxxxx\fct1.qvd(qvd);
FACT2:
load * from
xxxxxxx\fct2.qvd(qvd);
You no longer need the temp table and the names are shown correctly.
Mark
'I am not sure force concatenation is relevant here.'
where exactly have I used forced concatenation?
'If I am understand the issue correctly, it is just down to tables being named incorrectly, not down to any concatenation.'
Ideally you would name all tables but the capability to use the filename as the table name is also useful; which is what the OP is trying to achieve here and that is the problem that the temp table solves.
If you try the little experiment that I did maybe you will see what is happening, there is no problem in naming or concatenation of any sort. let me break it down simply. You can try the below with the script i posted above
Scenario1
Load Table1
Load Table2
store Table2 into tab2.qvd;
store Table1 into tab1.qvd
drop tables Table1,Table2;
// Normally each unnamed table will have the filename as table name, but >>
Load * from tab1.qvd <<< this table will be named tab1.qvd
Load * from tab2.qvd << this table will be named Table2.qvd , because Table2 was the last loaded table;
Scenario2
If we change the order in which the tables were loaded now loading Table1 after Table 2
Load Table2
Load Table1
store Table2 into tab2.qvd;
store Table1 into tab1.qvd
drop tables Table1,Table2;
// temp table script goes here >>
Load * from tab1.qvd <<< this table will be named tab1.qvd
Load * from tab2.qvd << this table will be named Table1 , because Table1 was the last loaded table;