Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I've been trying to load all tables from database
and creating QVDs automatically but not working properly.
If I add [] its getting an error and It working be fine if the table name has no spaces.
Suggest me on this where am wrong.
Tablelist:
LOAD*
Inline
[Tablename
Categories
Customers
Divisions
Order Details
Products
Shippers
Shipments
];
FOR i=1 to FieldValueCount('Tablename')
LET Vtable= FieldValue('Tablename',i);
SQL SELECT *
FROM [$(Vtable)];
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE [$(Vtable)] into $(VQvdPath)[$(Vtable)].qvd(qvd);
NEXT
Any suggestions will be appreciated.
this works in my test
SET VQvdPath= D:\Practice\Data\QVDS\;
FOR i=1 to FieldValueCount('Tablename')
LET Vtable = FieldValue('Tablename', $(i));
//trace $(Vtable);
[$(Vtable)]:
NoConcatenate LOAD *;
SQL SELECT * FROM [$(Vtable)];
STORE [$(Vtable)] into [$(VQvdPath)$(Vtable).qvd] (qvd);
NEXT
Sorry for my late response!
Finally I got all the tables in the data model along with Order Details( Syn table) table But why QVDs were not generated?Any Idea?
Same table name? Not sure I understand your question. Would you be able to elaborate?
Sunny there were no QVDs in the mentioned QvdPath it is an empty..Why it is?
Can you try this:
FOR i=1 to FieldValueCount('Tablename')
LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';
$(Vtable):
SQL SELECT *
FROM $(Vtable);
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);
NEXT
or
FOR i=1 to FieldValueCount('Tablename')
LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';
LET VtableStore = FieldValue('Tablename', $(i));
$(Vtable):
SQL SELECT *
FROM $(Vtable);
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE $(Vtable) into $(VQvdPath)$(VtableStore).qvd(qvd);
NEXT
Thanks maxgro its working great.
But am unable to understand your expression in that why did you use NOConcatenate keyword.?
If you don't mind,Would you be able to elaborate little bit more?
Thannks Again!
Thanks Sunny for your effort now your expression is working great!!!
May be you have 2 source tables with the same names and number of fields. Qlik will concatenate the tables and I don't want this. So I add a noconcatenate. Another way is to add a drop table after the store.