How can I filter only if there is something in the text input box? If the box is empty than we have no data coming up in my query because the variable is empty.
Is it server side or client side ?
Just use the condition field for the filter in the query builder to check if your get var has a value:
Thanks so much for your help! I got it to work. Another, more difficult problem has arisen. Does anyone know how I would go about doing this for several filtering fields?
This is the table that I am working with:
Here is what I have for the logic:
I have tried both AND/OR for the group. With both cases, it only lets me filter if the first # box has value.
Thank you all
The filtering was server side in the Query Builder
hello @mpardini ,
if you want to use filter multiple values you can use add rule / add group options . so add your fields in query builder then add parameters … (sorry I cant sent screen shot .I’m on mobile phone )
From what i see on your screenshot it must be working perfectly fine.
In your case - when the numberfield is empty and firstfiter is empty - all the records should appear.
When the numberfield has a value, it will filter by number field. As you are using AND for the two groups, if you enter a value in the firstfilter it will show the records which match the numberfield AND what is entered in the firstfilter.
@Teodor, this is absolutely correct “In your case - when the numberfield is empty and firstfiter is empty - all the records should appear.”
However, the desired behavior is to work like a filter in Excel. If one of the boxes has text, it will filter by only that field. If multiple have text, it will filter by all of the fields, if none have text then all results will be shown.
That’s how it is supposed to work with your current filters setup.
Your first filter in query builder does not allow the second filter to work.
If you look closely, the first
WHERE has a condition and the second
WHERE is inside the first one.
So, even if you have
numberfilter is not present it will not work.
DELETE the first filter. Use the top-level option to add another group for
numberilter. Remove the
numberfilter condition from top-level. Change the top-level condition-mode to
Theoretically, it should work.
Also, just a suggestion, keep the condition
contains instead of
equals for better UX.
This worked! Thanks so much