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

Tab name as a variable in script

Hi All,

how can I call tab name as a variable in script?

Regards,

Przemek

6 Replies
Not applicable
Author

hi

Load *, filename( ) as X from

C:\UserFiles\abc.txt

X takes value abc

Use filextension() for the extension

JJ

Not applicable
Author

Hi JJ,

not sure if know what I mean - within QV document I got a tab named "Data". On this very tab there's script in which I would like to use tab name - Data - as a variable. Hopefully, it's clear now.

Regards,

Przemek

Not applicable
Author

yes,

just make a variable.

as

set vtest = 'your tab name';

One thing, I would like to add here that tabs are different for just visual purpose only. for Qlikview there is no difference if you put your script in different tabs. because while executing it treats whole script as in one page only offcourse it is executed in a serial the way you put your tabs.

but, your script will not get to know in which tab this script is executing.

if you want to differentiate that then you can use one more variable and change its value with every tab.

hope it helps

...Ashutosh

Not applicable
Author

I think the goal here (and what I'm trying to find out as well) is how to get the variable set to the current tab name without having to type it in manually.

dmohanty
Partner - Specialist
Partner - Specialist

Hi,

Use like this:

LET vTableName = 'XYZ';

Load * from $(vTableName);

trucmuch
Contributor
Contributor

Hi,

i just bring a stone to the building (one year after !! ;-)), and to get the current tab name without having to type it in manually, use this :

let vTableName = TableName(NoOfTables()-1); // must be created after the table

After you have just to call the variable in the Load (ex :

                                             load *

                                             resident $(vTableName);)

Those functions are more usefull in a loop in order to create a table with all the table names, to have all tables created during the script.

Regards,

Davy