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

Generic Load help

Hi Experts,

Can any one please help me on below requirement,

I am trying Generic load In the below script. I am able to generate the  expected output from the inline source but getting below error while loading the script.

error of generic load.png

Please let me know am I missed any thing in the below script and Please help me to resolve the error.


InputTemp:
Load * Inline [
ID,Training,Completiondate,Duedate
145,Qlik,10/02/2018,1/03/2018
145,Tableau,10/04/2018,05/10/2018
158,Qlik,14/08/2018,15/08/2018
158,Tableau,18/09/2018,10/09/2018
];


/////////////converting the table to 3 columns //////////
InputTemp1:
Crosstable (Type, Dates, 2)
load *  resident InputTemp;

drop table InputTemp;


///////////////creating a key from status and type and running generic load to convert to one row //////////
Input:
Generic load ID ,
   Training& '_' & Type As Training,
   Dates
Resident InputTemp1;

drop table InputTemp1;


//////////////concatenating the tables to one table /////////////////////////////
let vTables= NoofTables(); // finding the number of tables

let vDataTableName = TableName(0);////finding the first table

RENAME Table $(vDataTableName) to Input;//converting the first table name

set errormode = 0;
////////////////finding all tables /////////////////////////////////////////
for i =1 to NoofTables()-1
Tables:
load TableName($(i)) as TableName ,$(i) as RN AutoGenerate 1;
NEXT
set errormode = 0 ;
for i=1 to NoofTables()-1
////////////////////////////looping through all tables//////////////////////
let vTableName =  FieldValue('TableName', $(i));
////////////////////////////adding the data////////////////////////////////////
join (Input)
load * resident  $(vTableName) ;
drop table $(vTableName);
next

drop Table Tables;
set errormode=1;

Thanks in advance.

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi

use this script

InputTemp:

Load * Inline [

ID,Training,Completiondate,Duedate

145,Qlik,10/02/2018,1/03/2018

145,Tableau,10/04/2018,05/10/2018

158,Qlik,14/08/2018,15/08/2018

158,Tableau,18/09/2018,10/09/2018

];



/////////////converting the table to 3 columns //////////

InputTemp1:

Crosstable (Type, Dates, 2)

load *  resident InputTemp;


drop table InputTemp;



///////////////creating a key from status and type and running generic load to convert to one row //////////

Input:

Generic load ID ,

   Training& '_' & Type As Training,

   Dates

Resident InputTemp1;


drop table InputTemp1;



//////////////concatenating the tables to one table /////////////////////////////

let vTables= NoofTables(); // finding the number of tables


let vDataTableName = TableName(0);////finding the first table


RENAME Table $(vDataTableName) to Input;//converting the first table name


//set errormode = 0;

////////////////finding all tables /////////////////////////////////////////

for i =1 to NoofTables()-1

Tables:

load TableName($(i)) as TableName ,$(i) as RN AutoGenerate 1;

NEXT




let vNoofIter = NoOfRows('Tables');



for i=1 to $(vNoofIter)

////////////////////////////looping through all tables//////////////////////

let vTableName =  FieldValue('TableName', $(i));

////////////////////////////adding the data////////////////////////////////////

join (Input)

load * resident  $(vTableName) ;

drop table $(vTableName);

next


drop Table Tables;

View solution in original post

1 Reply
lironbaram
Partner - Master III
Partner - Master III

hi

use this script

InputTemp:

Load * Inline [

ID,Training,Completiondate,Duedate

145,Qlik,10/02/2018,1/03/2018

145,Tableau,10/04/2018,05/10/2018

158,Qlik,14/08/2018,15/08/2018

158,Tableau,18/09/2018,10/09/2018

];



/////////////converting the table to 3 columns //////////

InputTemp1:

Crosstable (Type, Dates, 2)

load *  resident InputTemp;


drop table InputTemp;



///////////////creating a key from status and type and running generic load to convert to one row //////////

Input:

Generic load ID ,

   Training& '_' & Type As Training,

   Dates

Resident InputTemp1;


drop table InputTemp1;



//////////////concatenating the tables to one table /////////////////////////////

let vTables= NoofTables(); // finding the number of tables


let vDataTableName = TableName(0);////finding the first table


RENAME Table $(vDataTableName) to Input;//converting the first table name


//set errormode = 0;

////////////////finding all tables /////////////////////////////////////////

for i =1 to NoofTables()-1

Tables:

load TableName($(i)) as TableName ,$(i) as RN AutoGenerate 1;

NEXT




let vNoofIter = NoOfRows('Tables');



for i=1 to $(vNoofIter)

////////////////////////////looping through all tables//////////////////////

let vTableName =  FieldValue('TableName', $(i));

////////////////////////////adding the data////////////////////////////////////

join (Input)

load * resident  $(vTableName) ;

drop table $(vTableName);

next


drop Table Tables;