Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good morning all,
Need a little help with my script logic. I have built the following generic load and need some help on merging the 2 tables to 1. Thanks.
Temp2:
Load
Ship_accountid as ShipTo,
ContractStart_Year as Start_YR,
Count(distinct(opportunityid)) as NoOpptunities
Resident Opportunity
Group by Ship_accountid, ContractStart_Year
;
Temp3:
Generic Load
ShipTo,
Start_YR,
NoOpptunities
Resident Temp2;
Drop Tables Temp2
;
I have tried this logic but it takes all the tables in my model and I only want the ones from the generic load.
Let vNoOfTables = NoOfTables();
For cnt=0 to $(vNoOfTables)-1
Let vTableName=TableName($(cnt));
TableOverview:
LOAD
'$(vTableName)' as TableName //create a field to get the table names
Autogenerate(1);
Next
//Create one table
Let vTableNameFirst=Peek('TableName',0,'TableOverview');
Let vNumberOfRows = NoOfRows('TableOverview')-1;
For cnt=1 to $(vNumberOfRows)
Let vTableName=Peek('TableName',$(cnt),'TableOverview');
Join($(vTableNameFirst))
LOAD * Resident $(vTableName);
Next
//The part below could/should be also solved with a loop
Drop Table 'Temp3.2019',
'Temp3.2020'
;
Hey Thom, not sure if you got anything sorted or not, best I can offer are the following, hopefully may give you some further info to help you figure it out!
https://community.qlik.com/t5/Qlik-Design-Blog/The-Generic-Load/ba-p/1473470
Sorry I am not more help, but hopefully the Design Blog post may shed some light upon things to where you may be able to figure out what is going wrong and why.
Cheers,
Brett