Filter column using multiple arguments in a simple statement.
Is there a way analogous to the SQL '''VarX NOT IN ('value1','value2','valueN') ''' that can be used to filter data on a column, vs setting up an absurd series of statements where each value would have to be stated separately? (i.e !ISNULL(#VarX) && !CONTAINS(#VarX;"Value1") && !CONTAINS(#VarX;"Value2") && ... && !CONTAINS(#VarX;"ValueN") ?
I may be overlooking the obvious here.
-
There is not a direct equivalent to the SQL statement syntax, the compounded statements is an available work-around.
If you're searching for exact matches, not just containment you could build the list of value1, value2, valueN into the first argument of the CONTAINS function and then varX into the second argument. This will return true if varX matches one of the values and false if it matches none (you'll want to continue to verify it is not null first). This approach would reduce the length of the overall compound function significantly.
Please sign in to leave a comment.
Comments
1 comment