I am trying to use a field filter on a view table attribute. If i use text, it works fine but if i use a field filter on the same attribute, it gives me the error "Unknown column 'viewname.type' in 'where clause'.
Hi @Anum
Post "Diagnostic Info" from Admin > Troubleshooting, and the query to make it easier to help.
You are likely using table aliases, which is not supported, as noted in the documentation:
https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html#the-field-filter-variable-type
@flamber I am trying to add a field filter on type
attribute which is in order_item_info
. {{Category}}
is the dropdown that i need to add.
Select *
From order_item_info oii join order_item oi on oi.x=x join order_address oa on oa.y=oi.x
Where 1=1 [[and so.created_at>={{Startdate}} and so.created_at<={{Enddate}}]] [[and oii.type = {{category}}]]
- You cannot use table aliases with Field Filters
- You should not include the column or operator, when using Field Filters, since they are defined in the sidebar and controlled by Metabase.
https://www.metabase.com/learn/building-analytics/sql-templates/field-filters.html
select *
from order_item_info
join order_item oi on oi.x=x
join order_address oa on oa.y=oi.x
where 1=1
[[and so.created_at>={{Startdate}} and so.created_at<={{Enddate}}]]
[[and {{category}}]]
1 Like