Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Generic Load Script Logic

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'
;

 

 

Labels (1)
  • logic

1 Reply
Brett_Bleess
Former Employee
Former Employee

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://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/Scrip...

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

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.