I have a question with several field filter variables. Their types have been set in the Data Model, and link correctly when implemented into a dashboard.
I would like to use Public Sharing to directly share this question, rather than place it in a dashboard. However it only provides the ability to filter by the three filters shown, rather than all of the filters present in the query. I've had other questions where this happens, and it makes it rather inconvenient to share or debug a Question.
Hi @nick-sbp
Each of those variables is a Field Filter?
I haven’t seen this before unless “Filter widget type” was set to “None”.
Please check the browser developer console for errors.
Yes, each of them is a field filter. Although I’ve noticed some strange behavior with them. The Filter Widget type on three of them keeps resetting itself, although the correct type is available in the dropdown and selected within the datamodel.
This is the only error message displayed in the console:
Refused to connect to 'https://www.google-analytics.com/j/collect?v=1&_v=j87&a=807537344&t=event&_…0817802-1&_gid=2062261191.1605544152&_r=1&_slc=1&cd1=v0.37.0.2&z=114923642' because it violates the following Content Security Policy directive: "connect-src 'self' metabase.us10.list-manage.com ".
wd @ analytics.js:37
pe @ analytics.js:36
Sa @ analytics.js:41
Ha.D @ analytics.js:39
pc.send @ analytics.js:71
X.b.<computed> @ analytics.js:51
Z.v @ analytics.js:85
Z.D @ analytics.js:84
N @ analytics.js:85
trackEvent @ app-main.bundle.js?7…dac9c1025c4c0ef41:5
(anonymous) @ app-main.bundle.js?7…dac9c1025c4c0ef41:5
l @ vendor.bundle.js?7c4dac9…:98
(anonymous) @ vendor.bundle.js?7c4dac9…:98
(anonymous) @ vendor.bundle.js?7c4dac9…:98
r @ app-main.bundle.js?7…dac9c1025c4c0ef41:5
(anonymous) @ app-main.bundle.js?7…dac9c1025c4c0ef41:5
For instance on the variable ‘client’, I’d like the Filter Widget Type to be ‘Category’. It is set as such in the datamodel. However even after saving the question, it will reset itself to ‘None’. Although I’m able to hook into it when adding filters within a Dashboard.
@nick-sbp
I don’t know what is happening. I have never heard about this before. Please check with a browser without any extensions.
Does this happen with all questions or only this question?
Can you reproduce with a new question using the Sample Dataset: SELECT COUNT(*) FROM PRODUCTS WHERE {{Category}}
So I’ve found the solution. However as far as I’m aware this is not something that was mentioned in the docs, and may be considered a bug or user error.
In order for it to function correctly the variable name must match the actual column name. In the example I gave, the three working variables had names corresponding to their actual column name. Whereas with the others, the original creator of the table gave them godawful names, and so I named the variable something that represented it better semantically.
With the column names fixed it works correctly. For whatever reason this breaks the field filters in the Question editor, but the Dashboard editor seems invariant to the variable names when hooking into them.
There was another strange behavior with the broken column names I’d like to add though. For the broken columns, whenever I would edit the variable in the editor. It wouldn’t prompt me to save. As if I had made no changes to the variable.
Anyways @flamber I really appreciate the level of responsiveness, enjoy your day
@nick-sbp I cannot reproduce that. You can call the variable anything (like {{something}}) and reference a column called category. And then you can give the variable a display name of My Categories.
You can try with Sample Dataset:
SELECT COUNT(*) FROM PRODUCTS
WHERE 1=1
[[AND {{something}}]]
[[AND {{vendor}}]]
I think there has been something wrong with the initial variables (the actual reference code it makes behind the scenes), but there should have been errors in the browser console and/or log.