Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
rdsuperlike
Creator
Creator

Button On click Straight table

I have multiples straight tables and multiple buttons

when I click on a Button1 , I should see table box 1

when I click on a button2 , I should see table box 2

and so on.


Button 1 to 10 should be aligned on the left one below other and all the tables should appear as and when we click on each button

Any direction or help is appreciated.


5 Replies
robert_mika
Master III
Master III

Anonymous
Not applicable

Relatively straightforward to do this with a variable. Enter the following into a new script:

Load * Inline [

ItemKey,ItemSales

A,5

B,10

C,15

];

Set vCurrentTableSelection = 0;

Note the last line which initializes variable vCurrentTableSelection and sets it to zero.

Create a table as you normally would. Open up the table properties, go to the layout tab, and in the "show" section select conditional. Enter the following in the empty field to its right:

vCurrentTableSelection =1

As soon as you hit apply the table will disappear. The table will only be shown when the variable is equal to 1, but as of right now it's set to 0 (which is what we set it to in the script).

So now we have to change the value in the variable.

Create a button. For the text enter "Show Table 1." Move to the actions tab, hit add, select external, and then select Set Variable on the right. After you hit OK you'll see boxes on the right for Variable and Value. For variable enter vCurrentTableSelection and for value enter 1. Click OK. Now as soon as you hit this button the value of vCurrentTableSelection will change from 0 to 1, so the condition in the table will now evaluate to true and so it will show up.

You'll need to create 10 buttons and 10 tables. Each of the 10 tables will get a different value in the show conditional section. You can position the tables on top of one another -- it won't matter since only one of the table will show at any given time.

You can also have a default table show by setting the variable in the script to be equal to one of the values you've assigned to your tables.

tamilarasu
Champion
Champion

Check the attachment.

yogiachilleos
Contributor III
Contributor III

  1. Press Ctrl + Alt + V  (Brings up Variables)
    1. Add variable
    2. Name 'vButtons' (You can name whatever you want, but I will refer to as 'vButtons')
    3. Click 'Ok' (make sure you do this, if you press enter it will cancel out)
  2. Create a text object (You can do button, but texts are 100x better IMO)
    1. Type in 'text' (General Tab) whatever you want your button to display
    2. Go to Actions Tab
    3. Click 'Add'
    4. Select 'External' on left
    5. Select 'Set Variable' on the right
    6. Press 'Ok'
    7. In the 'Variable' box type 'vButtons' (Without single quotes)
    8. In the 'Value' box below type '1' (Without single quotes)
  3. Repeat step 2 but for sub step #8 increment the numbers by 1 (2,3,4,5,6,7,8,9,10)
  4. You should have 10 text objects each changing 'vButtons' value from 1-10.
  5. Now go to your first table/chart
    1. Go to Layout Tab
    2. Under 'Show' select 'Conditional' and put 'vButtons = 1' (Without single quotes)
  6. Repeat #5 until all 10 charts have their own 'vButtons = #' (1 - 10)

There are more efficient other ways of accomplishing this task, but this is by far the easiest to comprehend without someone showing you how to do them.

You can also do a lot of cool design work with the same 'vButtons' variable you created.

If you want to learn a more complicated (but efficient method) research into creating inline tables with expressions. (This would have taken me a lot longer to explain... but worthwhile to learn about (This also has a higher chance of being resource heavy, so there are negatives to this secondary approach)).

Good luck!

Yogi Achilleos