Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ali_hijazi
Honored Contributor

help in script syntax

Hello

I'm working on Qlik Sense project

I'm reading the names of the tables and looping through them to read and store data as qvd

my script is as follows and it works correctly in QlikView:

temp_tables:

    load *;

    sql select

   table_name as name

        from information_schema.tables

        where table_schema = 'lmms'

and lower(table_name) in
(
               'community'

                    ,'person'

                    ,'member'

                    ,'marital_status'

                    ,'household'

                    ,'household_condition'

                    ,'gov_id'

                    ,'gov_id_type'

                    ,'member_vulnerability'

,'member_vulnerability_assoc'

                    ,'distribution'

                    ,'location'

                    ,'project'

                    ,'fdp'

                    ,'item'

                    ,'project_type'

                    ,'member_status'

                );

/*************************************************************************************/

    /*

   now read data and store each table as QVD file

    */

for i=0 to NoOfRows('temp_tables')-1
let vTableName = Peek('name',$(i),'temp_tables');
if left('$(vTableName)',1) = '@' then
let vTableName = '"' & '$(vTableName)' & '"';
endif
let vQlikTableName = replace(Replace('$(vTableName)','"',''),'@','');
$(vQlikTableName):
load *;
sql select * from $(vTableName);
store $(vQlikTableName) into lib://QVDS/$(vQlikTableName).qvd;
drop table $(vQlikTableName);
next

tables are stored as such

Untitled.png

how to evaluate vQlikTableName?

Please advise

1 Solution

Accepted Solutions
ali_hijazi
Honored Contributor

Re: help in script syntax

not as such but it worked as follows:

store $(vQlikTableName) into 'lib://QVDS/'$(vQlikTableName)'.qvd';

2 Replies
vinieme12
Esteemed Contributor II

Re: help in script syntax

store $(vQlikTableName) into lib://QVDS/'$(vQlikTableName)'.qvd;

Try with single quotes

ali_hijazi
Honored Contributor

Re: help in script syntax

not as such but it worked as follows:

store $(vQlikTableName) into 'lib://QVDS/'$(vQlikTableName)'.qvd';

Community Browser