Variables AND, GROUP BY

OK, I’ve been able to figure out how to use variables on the right side of where
[[ AND {{company}}]]
[[ AND {{employee}}]]

Now I want to add the GROUP BY
I tried this :
[[ , {{company}}]]
[[ , {{employee}}]]

I don’t need the value of company variable, if it is set.
I need the name of the column “Company” if the company variable is set
IE : GROUP BY Company
IE : GROUP BY Employee
IE : GROUP BY Company,Employee

I tried : [[ AND {{company}} GROUP BY Company ]]
[[ AND {{company}} AND {{employee}} GROUP BY Company,Employee ]]
That doesn’t work.
Any ideas?

Hi @bpatton
It’s not possible to use Field Filters like that. You have a bit more flexibility with normal filters.
Not sure why this doesn’t work - what’s the error? [[ AND {{company}} GROUP BY Company ]]
It would require something like this to be able to work: - upvote by clicking :+1: on the first post

There’s no “error” it just doesn’t do the group by, where it should return the max displayable rows, it only shows 1 row. If I move the GROUP BY outside the [[]] then is works as expected.

@bpatton It’s an optional clause, so it will only be activated, when {{company}} filter is used.
I have a feeling that it’s caused by bad column reference. I don’t know which database you’re using, but try using the full reference schema.table.column

1 Like