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

Load data inverse

Hi, can someone help me to understand the script in generic load ?

Table1:

load * inline [

ID,name,type,value

1,A,blue,10

1,A,yellow,50

3,C,red,80

3,C,yellow,60

4,D,yellow,40

];

Table2:

generic load *

resident Table1;

ResultTable:

LOAD Distinct ID, name Resident Table1;

FOR i = 0 to NoOfTables()

  TableList:

  LOAD TableName($(i)) as Tablename AUTOGENERATE 1

  WHERE WildMatch(TableName($(i)), 'Table2.*');

NEXT i

FOR i = 1 to FieldValueCount('Tablename')

  LET vTable = FieldValue('Tablename', $(i));

  LEFT JOIN (ResultTable) LOAD * RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];

NEXT i

Drop Tables Table1, TableList;

And i want to ask what is the purpose of AUTOGENERATE 1 and NoOfTables() ?


Really need your help.

Thanks in advance.

4 Replies
Not applicable
Author

Hi,

Generic load is used for unpacking and loading of a generic database.

When we are using generic load each column is created as a single table.For example if we have 10 columns in our generic database we get 10 tables, which is not considered efficient in the data modelling .So to combine all the tables generated through generic load and drop those tables we are writing the FOR loop.

NoofTables() is used to set the limit for the for loop.It gives the no. of tables present in the data model.

Whereas autogenerate is used if data should be automatically generated by QlikView.

Thanks,

Reshma.

qlikviewwizard
Master II
Master II

Ralf-Narfeldt
Employee
Employee

AUTOGENERATE 1 generates one record/row.

For example:

LOAD 3 As Three AUTOGENERATE 4;

would generate a table of four rows, containing a single field called Three with the value of 3.


NoOfTables() returns the number of tables previously loaded.



Not applicable
Author

Hi All,

Thanks for your explanation, it makes me clear about generic load.

Thanks in advance