Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
yamananalytic
Creator II
Creator II

Rename table is not working!!!

Hi guys,

i want to change the name of four tables using this script

For vTableNo = 1 to NoOfTables()-1

let svalue='tab1';

Let vTableName = TableName($(vTableNo)) ;

Rename Table vTableNo to svalue;

next  vTableNo

but nothing happens.

p1.pngswuehl

stalwar1

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I believe RENAME TABLE should use the table name vTableName, not the number vTableNo as source table name.

Using dollar sign expansion might also be required to get the variable values.

Rename Table $(vTableName) to $(svalue);

Then I am not sure what you are trying to achieve here, do you want to rename all tables to the same name?

I don't think that can work (well, haven't tried it).

Or do you want to do something else?

View solution in original post

3 Replies
swuehl
MVP
MVP

I believe RENAME TABLE should use the table name vTableName, not the number vTableNo as source table name.

Using dollar sign expansion might also be required to get the variable values.

Rename Table $(vTableName) to $(svalue);

Then I am not sure what you are trying to achieve here, do you want to rename all tables to the same name?

I don't think that can work (well, haven't tried it).

Or do you want to do something else?

View solution in original post

bill_markham
Champion III
Champion III

And here is a sample bit of script:

For vTableNo = 0 to NoOfTables() -1

trace vTableNo: $(vTableNo) ;

let vTabNum = $(vTableNo) +1 ;

trace vTabNum: $(vTabNum) ;

let svalue='tab' &  $(vTabNum) ;

trace svalue: $(svalue) ;

Let vTableName = TableName($(vTableNo)) ;

trace vTableName: $(vTableName) ;

Rename Table $(vTableName) to $(svalue) ;

next  vTableNo

The trace command is always useful when debugging thing like this, I have whacked a few in so you can see what it is doing.

yamananalytic
Creator II
Creator II
Author

thanks very much.

it is working