Auto-running Saved Questions

#1

Hey guys,

I’m currently having an issues with end users where a saved question will automatically attempt to produce a result unless one of the filters is set to required variable, or set to a default result that returns nothing.

My question is, is there a setting or option to have saved questions require the Get Answer button be pressed before any data is produced?

Thanks in advance.

#2

Hi @zDogwatch
Which version of Metabase?
I’m not sure I understand. So you have a “Saved Question”, but it doesn’t return anything until you define a filter? Is it a Custom Question or Native Question? If Native, are you using parameters/filters?

#3

Hi @flamber

Allow me to clarify.

I have a saved question from a native query.

The user accesses the query and it automatically attempts to run the query with no filters entered.

Native Query is saved -> End user accesses it from collection -> Query automatically attempts to produce results (this is what I’m attempting to stop)

The code would look something like

select *
from table
where
   true
   [[and filter1 = {{filter1}}]]
   [[and filter2 = {{filter2}}]]
   [[and filter3 = {{filter3}}]]
...
limit 10

This query is designed to filter through a larger table once the filters are set, but the filters can be a combination or singular inputs but WE DON’T wish it to run automatically when visiting the question.

I understand there is a cancel button available, but I’m curious if there is any way to stop the query from running without setting a variable to required, or setting a default variable so that that query produces no results.

#4

Which version of Metabase?
Are the filters always required to be input? If yes, then you can remove the optional clauses [[...]]
EDIT: There’s currently no setting for disabling the automatic “Get Answer”.

1 Like
#5

Version 0.31.2

The filters are not always required, but one filter will always be input(just not always the same one). We just were looking for a way to have it not run automatically, but can just continue using cancel button for now.

#6

Okay, I cannot tell which database you’re querying, but you could do something like this:

select *
from table
where
  COALESCE([[{{filter1}},]] [[{{filter2}},]] [[{{filter3}},]] NULL) IS NOT NULL
  [[and filter1 = {{filter1}}]]
  [[and filter2 = {{filter2}}]]
  [[and filter3 = {{filter3}}]]
...
limit 10
1 Like
#7

That does produce a No Results page which is a bit of an improvement. I appreciate you sharing that.