How to make DS return an empty set
This is an open discussion with 6 replies, filed under General.
Search
Use parameters fallback: {$id:0}
Thanx!
Or, even better; there is an option for that! It's below the filtering, look for "return no results when parameter is not set".
Hm, I don't see anything like "return no results when parameter is not set" in my data sources setup. Is it added to some newer than 2.3 Symphony version?
Add a parameter, and if it isn't set, no results will be returned.
Ah! I keep forgetting about this "Required URL Parameter" thing.
The fact that it is placed in the "Output Options" part of the form always confuses me.
Create an account or sign in to comment.
Hi!
Talking about a standard DS. I want to filter entries by their system id's.
Assume the name of the parameter is 'id'.
So, the classical way would be just to set the filter pattern to:
The problem is, that if the parameter does not exist, all the entries are returned.
But I want it to return no entries in that case.
I tried different patterns, and the only one which seem to work is:
I wonder, may be it is just a coincidence, and the results will not be consistent through Symphony or php or whatever versions changes? Also, I wonder why the other patterns did not work, like:
or
The two above never match.