Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
the_murkle_man
Contributor II
Contributor II

Change sheet based on variable selection

Hi Guys,

I've ran into a problem which so far has stumped me but I'm sure someone on here will have an answer!

In my dashboard I have a homepage with various different buttons e.g. Revenue, Cost, Delivery etc.

These buttons then lead to a second menu page where users have the ability to select a Division/Country.

This looks like this.

Nav.PNG

These buttons will then apply variables depending on what you clicked. For example clicking the upper left 'WAM' will show data for WAM UK.

Historically all charts have been available in 1 tab with variables dictating what view users get.

Now for the tricky part!

I would like to separate this out into different tabs for Revenue, Cost etc.

What I don't want to do if I can avoid it however is have to create the tab pictured above for each different sheet.

The idea I had was to create another variable called 'vNav' which is assigned a value from the home page button you click on.

So Revenue would be 1, Cost 2 etc.

My intention then would be to assign a macro which would direct the document to the correct tab before applying the variables from the buttons.

I have tried to create a macro something along the lines of;

Sub NavRev

    Set v = ActiveDocumentGetVariable("nRev")

    IF v = 1 Then ActiveDocument.ActivateSheetByID "Revenue"

  

    Then IF v = 2 Then ActiveDocument.ActivateSheetByID "Cost"

  

    Else IF v = 3 Then ActiveDocument.ActivateSheetByID "Delivery"

  

    End IF

  

    End IF

  

End Sub

This is currently well off the mark and just crashes the document every time i execute it.

Hopefully someone has an idea of what I'm trying to achieve.

Thanks in advance.

N

1 Solution

Accepted Solutions
the_murkle_man
Contributor II
Contributor II
Author

Well it seems I made that way more complicated than it needed to be...

Whoops.PNG

Whoops

View solution in original post

1 Reply
the_murkle_man
Contributor II
Contributor II
Author

Well it seems I made that way more complicated than it needed to be...

Whoops.PNG

Whoops