6 Replies Latest reply on Dec 21, 2016 1:29 PM by David Schultz

    Actions and Parameters

    David Schultz

      Is it possible to have a user click run another query?


      Here is my scenario:


      I have a live SQL query that returns a list of IDs based on a parameter. I want to then allow the user to click on any of the IDs in the results which will then run a seperate query based on the ID that they click and display different results from a live query.


      Hypothetical Example: The user comes to a blank dashboard with a parameter. They type in "USA" and then one worksheet lists all the states from a live query. Then the user clicks on any state in the worksheet and then another worksheet runs a query to return the cities of that state.


      Is it possible?


      Thank you so much,


        • 1. Re: Actions and Parameters
          Matthew Risley



          I would create two sheets: One for the first click, and one for the second click.


          The second click sheet (the one filtering by state). Should have all the ID's by state.


          Then use dashboard actions to filter the second sheet on 'State' when the first sheet is clicked.


          I hope that helps. I can also answer additional questions if you have any.

          • 2. Re: Actions and Parameters
            David Schultz

            That works if I'm not using live queries.


            I don't want the 2nd sheet to execute until I click on the first sheet. And then I want the ID that they click on to be passed into a parameter that will be used in the 2nd query.


            The issue is that I cannot create a full datasource of the 2nd query to let the first sheet just filter the 2nd. I need to run the 2nd sheet with a live SQL query.



            • 3. Re: Actions and Parameters
              Matthew Risley

              When you say 'Live SQL Query' are you talking about a live connection to a SQL Database?


              Tableau itself uses a SQL language called VizQL to run all of it's queries in the background to get the data that you need based on filters, selections, etc.

              • 4. Re: Actions and Parameters
                David Schultz

                Yes, a SQL database query.


                I have 1 SQL query that runs on a parameter that returns a list, and when I click on one of the results I want to run a completely different SQL query using the ID that I just clicked on from the first query and run a second query.




                • 5. Re: Actions and Parameters
                  Matthew Risley

                  Please forgive me and I'm missing something obvious (could likely be the case)


                  But I still think that Dashboard actions are what you need. You can create a custom dashboard action and run a 'Second Query' based on whatever selection you make on the first sheet.

                  You can check 'Selected Fields' to ensure it is returning exactly what you'd like. The pick the fields: (Please excuse black bars)


                  • 6. Re: Actions and Parameters
                    David Schultz

                    Ok. You were right. Awesome!


                    The problem I had is that I had a parameter in my live query still and so it wasn't working. When I removed the parameter from my query then the action filter worked.


                    Much appreciated.