Filter for (not) empty text field in query
Hi,
I want to have an optional query clause to filter for entries which have a value (strlen greater 0) on a text field.
Unfortunately I am not able to use the strlen filter on the condition/field.
I know I can just leave the value side of the condition empty, but I want to make the where clause conditional by an input parameter.
I know I could just simply copy the whole query and then add a switch/if statement before that. But thats not very elegant I want to avoid such a query/endpoint design.
Any ideas how to solve that?
Best Answer
-
So you will still need to uncheck that checkbox to filter your records as described. Ignoring empty values will not abide those empty values to your expression.
Your boolean input would only come into play in a Conditional (IF...THEN...ELSE) statement.
IF input: with_text == true
THEN
Query all records WHERE db review.review_text = (do not ignore empty values)
ELSE
Some other statement
Answers
-
Hi @Stefan Pointecker - I would just use the expression you have but don't check "ignore empty values" because that is the opposite of what you want.
-
Hey @Michael Udinski
yep I know. But I wanted to have that clause conditional by an input parameter. e.g. I have a boolean parameter "with_text" and only if that is set to "true" I want to have that clause enabled.
-
Okay, yeah thats what I suspected. Would be a gread addition to the query builder to have conditions on part of the statements :)
I solved it that way you described it but thought there must be a nicer solution to that.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback