Exclude multiple entry ID's from a DS
This is an open discussion with 4 replies, filed under General.
Search
What about this...
Create another data source 'similar entries exclusion' that has the current dog and/or any paired dog.
Then filter your 'similar entries' data source by not:{$ds-similar-entries-exclusion.system-id}
.
Pretty sure not: {$ds-adoption-dog.system-id}, {$ds-adoption-dog.paired-with}
will do the job.
Reasoning:
- The Datasource class will parse the filter and see the
,
, causing it to break the string into an array with two parts,not: {$ds-adoption-dog.system-id}
and{$ds-adoption-dog.paired-with}
. - The Association field will inspect the first part (
$data[0]
) and find thenot
flag, so will set negation for the entire filter. This step also removesnot:
from the first part. - Association field will then check what the filter type is, in our case it's not an AND operation, so it'll proceed to implode
$data
to construct aNOT EXISTS
subquery.
I haven't tested this, but reading the code, that is what should work.
@nathan can confirm what @brendo stated, I've been using the not ID filter for a while now.
Awesome, thanks for the suggestions - I'll give the comma a shot!
Edit: That did the trick, thanks!
Create an account or sign in to comment.
I have a basic 'similar entries to' widget on a Symphony site. The site is animal rehoming and some of the animals are 'paired' with another animal (i.e. two dogs to be re-homed together).
As part of the 'similar entries to' DS I need to explude both the animal being shown, and any that might be 'paired' with it.
This is a DS chain situation, using an Association field to pair entries.
This works for removing the current entry from the DS:
not:{$ds-adoption-dog.system-id}
However whatever I try I can't get a second ID in there, neither of these work:
not:{$ds-adoption-dog.system-id} or not:{$ds-adoption-dog.paired-with}
not:{$ds-adoption-dog.system-id or $ds-adoption-dog.paired-with}
(When I say 'not work' I mean it doesn't filter the DS at all, so neither condition parses)
Is it possible? If so what's the syntax?