[Solved] Filters don't work sometimes

Hi,

we're evaluating Metabase and i created a model with SQL variables inside.

Now to the curios part:
If i set a the variable in the table view, i see the value changes in the url, but else it nothing happens.
When i then press the refresh button on the right, the changed values do not apply to the data.
When i then go into the sql editor mode, the variables get instantly applied to the preview below, even the preview hasn't any filter widgets.
The same applies if i set default values for the variables in the sql mode. If i press refresh, then don't get applied.
Also if i open another browser and copy the url with the filter values in it, they don't get applied. I see the values in the filter widget, but thats it.

Also strange:
Sometimes old parameter where applied, i've tried some times ago and they don't go away if i change the value again.

I can inspect the http querys in the browser, and i can see that sometimes no or wrong parameters are in the query. It look like a frontend/js problem to me.

{
  "browser-info": {
    "language": "de-DE",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.15+10",
    "java.vendor": "Eclipse Adoptium",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "11.0.15",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.15+10",
    "os.name": "Linux",
    "os.version": "4.18.0-372.9.1.el8.x86_64",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "h2",
      "mysql",
      "sqlserver"
    ],
    "hosting-env": "unknown",
    "application-database": "mysql",
    "application-database-details": {
      "database": {
        "name": "MariaDB",
        "version": "10.5.15-MariaDB-0+deb11u1"
      },
      "jdbc-driver": {
        "name": "MariaDB Connector/J",
        "version": "2.7.5"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2022-06-13",
      "tag": "v0.43.3",
      "branch": "release-x.43.x",
      "hash": "c9c7ef0"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Hi @Euratel
That sounds like a frontend problem, but difficult to say what is causing it.
Check the browser developer console.
Try a different browser, or at least without any extensions.
Make sure you don't have some reverse-proxy causing problems/caching:
https://www.metabase.com/docs/latest/troubleshooting-guide/proxies.html

I've ruled haproxy out, by going directly to the docker/metabase port and using this.
Also i've tried that it in an blank firefox profile without any plugins.

The console says:

Setting moment.js start of week for Locale de to monday
StructuredQuery.ts:340 Warning: can't clean query without metadata!

@Euratel I'm having a little difficult understanding your wording, since we use the word Models, which means https://www.metabase.com/docs/latest/users-guide/models.html, but Models currently don't allow variables, so that's not possible.
Perhaps you can record a screencast of the problem.
Given the amount of installations running Metabase, then I'm fairly sure it's something locally to your setup.

Ok, now i know whats going on.
The key is: "Models currently don't allow variables"

Yes, i can't convert a sql question to a model, if there are variables in the questions, i get an error message.
However, i can remove the variables, convert the question to a model and then add the variables in the sql query without any warning. If you do that, strange things happens, and thats what i done :stuck_out_tongue:.
Interestingly if you add this model to a dashboard and add a filter there, it works also with model + variables :upside_down_face:

But it's ok, if you say metabase doesn't support this for now. I've just wasn't warned, when i used them.

Btw: It would be very cool, if models would support variables, so that a question could fill in some parameters to the model.
Also if you could reference in SQL questions with parameters would be awesome, something like this pseudocode:
SELECT count() FROM {{#5, {{myparam1}}, {{myparam2}}}}
or
SELECT count(
) FROM {{#5, 12, "text"}}

I know i can copy the models sql query and

@Euratel I've created an issue to remove the Variables sidebar from Models:
https://github.com/metabase/metabase/issues/23505 - upvote by clicking :+1: on the first post

1 Like

Thank you. I really hope we get variables to models and nested queries, that would make many thing way easier.