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

Drop Table $(variableTableName);

Hi Guys,

i'm trying to use a variable table name into the Drop Table instruction and that seems to not work as intended.

Indeed, i'm working with tables generated according to variable names like :

FOR EACH vInputFile In FileList('.\INPUTS\*')

     ...

     $(currenttablename)$(tablesuffix):

     LOAD * FROM InputFile;

     ...

     STORE $(currenttablename)$(tablesuffix) INTO '.\STORE\$(currenttablename)';

NEXT vInputFile

And after that, i have to purge memory :

FOR iTableNo = 0 to NoOfTables()-1

     Let CurrentTable = TableName('$(iTableNo)');

     IF WildMatch(CurrentTable,'*$(tablesuffix)') THEN

          Drop Table $(CurrentTable);

     ENDIF

NEXT

My problem is that this statement : Drop Table $(CurrentTable);

The variable table name seems to not be replaced correctly during execution, and QV return and error :  "Table unavailable : Drop Table statement"

Is drop table working with variable table name ?

Thanks in advance for your help.

1 Reply
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi,

Yes it should work with dollar sign expansion.

Does any of the CurrentTable values has a space in it? If yes, the DROP must be adjusted to:

Drop Table [$(CurrentTable)];

FOS