Check if sql query is empty
I want to use dynamic query building specifically if my other query is non-empty.
My code block should determine is a specific value was passed as input (location data). If it wasn't then the query should be run as normal. If it has then I should adjust query where clause using the helper function.
Having problems with when no input is provided because I can't compare my variable to
sql.empty()
or sql''
template.
Here is the snippet:
1 Reply
Solved by not assigning
locationSqlClause
unless necessary and checking using if != undefined
... linter cries a bit but works