Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

In DB Filter - select all values unless input text has value

abell_dt
7 - Meteor

I want to have an In DB filter not filter anything if the text input is blank. Trying to write the custom expression in the filter in db tool. 

 

I've tried both of these but the * is treated as a string on the first one and the second.  Any tips?

 

"Column" = '*'

 

.....................

 

 

IF LEN("Placeholder") = 0
SELECT *
ELSE
SELECT * WHERE "Column" = "Placeholder"
END IF

2 REPLIES 2
jdrummey
9 - Comet

The In-DB Filter tool needs to be configured like the regular Filter tool in that the given expression needs to return a boolean True/False for each record. So your syntax will be something like this:

 

IF LEN("Placeholder") = 0 THEN True ELSE "Column" = "Placeholder" END IF

 

Jonathan

 

 

abell_dt
7 - Meteor

I tried using this and it still returns an error

 

Incorrect syntax near the keyword 'IF'.\42000 = 156
in Query: WITH "Tool239_8883" AS (select *
from "scrubbed table name") SELECT * FROM "Tool239_8883" WHERE IF LEN("Placeholder") = 0
THEN True
ELSE "Columnname" = "Placeholder"
END IF

Labels