Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
louise119
Creator III
Creator III

Switch another table with button

Hi,
I create a table.
I want to switch the table with another table by pressing the button.

Is it possible?

1 Solution

Accepted Solutions
N30fyte
Creator
Creator

Your Tables A and B look identical, but assuming that in 'real life' they would be different...

Create a Container object and drag both tables into it. From this:

tables for toggling.jpg

 

You get this:

tables in container.jpg

At this point you can toggle between the two tables by clicking on their headers in the Container.

If you want to use a button to hide and display the tables completely, then there are a few extra steps.

First, create a new Variable. I shall call mine vTableToggle:

table toggle variable.jpg

Its initial value ('Definition') is set to 0.

Now create a Button object.

toggler button.jpgUnder Actions and Navigation, click Add Action and choose Set Variable Value from the dropdown. 

The Variable for this action is the name of the variable just created - in my case vTableToggle. 

The Value for this action is:

= if(vTableToggle = 0,1,0)

This means: if vTableToggle is 0, set it to 1, otherwise set it to 0.

Return to your container.

In the properties bar, under Charts, click the disclosure arrow for your first table and set the Show condition to 

=vTableToggle = 0

fruit toggle.jpg

When vTableToggle is 0, your first table is shown. When vTableToggle is anything else, it is hidden.

Now click the disclosure arrow for your second table and set the Show condition to

=vTableToggle=1

When vTableToggle is 1, your second table is shown. When vTableToggle is anything else, the second table is hidden.

Come out of editing mode and your second table should immediately disappear - because the initial value of vTableToggle was set to 0.

Clicking the button will switch vTableToggle between 0 and 1, and your first and second tables will be shown and hidden depending on the variable value.

toggled fruit.jpgYou can tidy up the headers in the container and the tables so that they don't repeat themselves. And for extra points you can change the label on the button depending on which variable is toggled - eg 'Show Table B' when Table A is displayed, and vice versa.

 

View solution in original post

6 Replies
PrashantSangle

Switch to another table? what actually you trying to do??

You can create conditional expression in same table? and make it enable as you select specific button.

On button click you have to set up the variable value and according to your variable value, you can enable or disable expression in table.

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
N30fyte
Creator
Creator

If the tables have the same dimensions, you can use a button to toggle between field selections, which has the effect of  'switching between tables'. 

If they have different dimensions, you can use a container, drag in both tables and use a button with a variable to toggle the display conditions. 

Let us know which you want...

louise119
Creator III
Creator III
Author

Thank you for reply.
I want to switch table A and table B created by script between table A and table B with a button or something on the same place. just  switch the table .

switch.png

switch2.png

  

louise119
Creator III
Creator III
Author

Thank you for reply.
I want to switch table A and table B created by script between table A and table B with a button or something on the same place. just  switch the table . Is it possible ?

switch.png

switch2.png

  

N30fyte
Creator
Creator

Your Tables A and B look identical, but assuming that in 'real life' they would be different...

Create a Container object and drag both tables into it. From this:

tables for toggling.jpg

 

You get this:

tables in container.jpg

At this point you can toggle between the two tables by clicking on their headers in the Container.

If you want to use a button to hide and display the tables completely, then there are a few extra steps.

First, create a new Variable. I shall call mine vTableToggle:

table toggle variable.jpg

Its initial value ('Definition') is set to 0.

Now create a Button object.

toggler button.jpgUnder Actions and Navigation, click Add Action and choose Set Variable Value from the dropdown. 

The Variable for this action is the name of the variable just created - in my case vTableToggle. 

The Value for this action is:

= if(vTableToggle = 0,1,0)

This means: if vTableToggle is 0, set it to 1, otherwise set it to 0.

Return to your container.

In the properties bar, under Charts, click the disclosure arrow for your first table and set the Show condition to 

=vTableToggle = 0

fruit toggle.jpg

When vTableToggle is 0, your first table is shown. When vTableToggle is anything else, it is hidden.

Now click the disclosure arrow for your second table and set the Show condition to

=vTableToggle=1

When vTableToggle is 1, your second table is shown. When vTableToggle is anything else, the second table is hidden.

Come out of editing mode and your second table should immediately disappear - because the initial value of vTableToggle was set to 0.

Clicking the button will switch vTableToggle between 0 and 1, and your first and second tables will be shown and hidden depending on the variable value.

toggled fruit.jpgYou can tidy up the headers in the container and the tables so that they don't repeat themselves. And for extra points you can change the label on the button depending on which variable is toggled - eg 'Show Table B' when Table A is displayed, and vice versa.

 

louise119
Creator III
Creator III
Author

Thank you so much!

It works! I appreciate for your kindness.