Data Sources: Filter by not empty field value
This is an open discussion with 4 replies, filed under General.
Search
What field are you filtering on? In the latest version (2.2+) some Symphony fields support this "negation" logic.
For a Select Box Link you can use:
sql: NULL
for entries that have no related entrysql: NOT NULL
for entries that have a related entrynot:foo
to match values that do not equalfoo
Text Input fields support regular expression filtering, which maps directly onto the MySQL REGEXP
function. So you can use:
regexp:[a-zA-Z]
for values that begin with a letter A-Z (upper or lower case)not-regexp:[0-9]
for values that do not begin with a number
So if you only wanted entries that do not have a value for the field at all, you could assume that the data value will always be alphanumeric (a-z, A-Z, 0-9) if it is set, and use not-regexp
:
not-regexp:[a-zA-Z0-9]
I haven't tested it, but I think that should work.
regexp:^.+$
This worked for me. Thanks for the reply, Nick
Or that :-)
For some reason empty values in a Select Box Link field are considered linked to an entry with id = 0. I had to use not:0
to exclude those with no related entries. It's probably a feature, but I've missed it or forgotten about it (: !
Create an account or sign in to comment.
Hi, Guruz, didn't find the answer on the forum :-( Of course i can use xslt to filter out section fields with empty value, but filtering ds seems to be more elegant way.