I use the following 2 generic scripts often in my development live Cycle.
- Store and Drop all the Qlikview tables in your Model. This can be applied in the RAW or Functional Data Layer.
let noTabs = NoOfTables();
set name = ”;
for t = 0 to $(noTabs) -1
let tab = TableName( $(t) );
store $(tab) into $(tab).qvd;
let name = ‘$(name)’ & ‘,’ & ‘$(tab)’;
next t;
let name = mid(replace(‘$(name)’,’,’,
for each tabname in $(name)
drop table ‘$(tabname)’;
next tabname;
- Extracting the exact same tables out of different databases- you need them to be consolidated in Tables with a field Identifier
- FOR EACH COMPANY IN ‘COMPANY1′,’COMPANY2′,’
COMPANY3′
OLEDB CONNECT TO $(COMPANY); //SETUP CONNECTION STRING REPLACING COMPANY/DATABASENAME WITH VARIABLE
//DATA
FOR EACH File IN ‘TABLE1′,’TABLE2′ ,’TABLE3′,’TABLE4’
$(File):
LOAD *,
‘$(COMPANY)’ AS COMPANY,
‘$(File)’ AS $(File)
;
SQL SELECT *
FROM dbo.$(File);
NEXT File
NEXT COMPANY