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

Variables as file and table paths in load script

Hi,

I'd like to assign table names and source files to variables and use it throughout my load script.  Like so..

SET vSourceFileName0 = 'source_file_1.csv';

SET vSourceFilePath0 = 'C:\my files\Sept2013\';

SET vSourceTableName0 = 'MS_SQL_table_1';

MySQLTable:

SQL SELECT * FROM vSourceTableName0;

MyFileSource:

LOAD *

FROM

vSourceFilePath0 & vSourceFileName0

(txt, codepage is 1252, embedded labels, delimiter is ',', msq, no eof);

Doesn't seem to be working...

1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

SET vSourceFileName0 = 'source_file_1.csv'; 

SET vSourceFilePath0 = 'C:\my files\Sept2013\'; 

SET vSourceTableName0 = 'MS_SQL_table_1'; 

 

MySQLTable: 

SQL SELECT * FROM $(vSourceTableName0); 

 

MyFileSource: 

LOAD * 

FROM 

$(vSourceFilePath0)$(vSourceFileName0)

(txt, codepage is 1252, embedded labels, delimiter is ',', msq, no eof);

Regards,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

2 Replies
Not applicable
Author

Hi,

Try to retrieve the variable value with $(vSourceFileName0)

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

SET vSourceFileName0 = 'source_file_1.csv'; 

SET vSourceFilePath0 = 'C:\my files\Sept2013\'; 

SET vSourceTableName0 = 'MS_SQL_table_1'; 

 

MySQLTable: 

SQL SELECT * FROM $(vSourceTableName0); 

 

MyFileSource: 

LOAD * 

FROM 

$(vSourceFilePath0)$(vSourceFileName0)

(txt, codepage is 1252, embedded labels, delimiter is ',', msq, no eof);

Regards,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!