Search

Hi,

is there a way to filter a data source with a ds-param, but taking only those values that do not match the given parameter.

i have one type of entry and two data sources. the first ds gets only the latest entry and generates an Output Parameter of $ds-single with the System-ID of the entry. In the second data source i only want to pull together all the entries sans the one i get in the first data source. I was going to try something like not($ds-single) as a Filter on the second datasource, but there seems to be no way that you can filter in this direction.

maybe i'm just not seeing the obvious here.

thanx in advance, daniel

As far as I know the System ID filter does not support negation. Some fields do, via regular expressions (not-regexp:) such as the Select Box Link, but I don't think System ID or System Date do.

However there could be a workaround. You could add a Reflection Field to the entry which is configured to store the entry ID as its value when the entry is saved. The net result is a text input field in your entry that contains the entry ID as its text value. The Reflection Field supports some advanced filtering syntax prefixes like regexp: and not-contains: which might work (although right now I don't see support for not-regexp: in the code).

If you actually want to select all other entries, why don't you just use a single data source to get all entries and filter the single one out using XSLT? One data source, same result.

hi nick,

thanks for the quick reply! i will go through the posts you mentioned and maybe try the reflection field. although i don't really want to complicate this so much.

I would use a single datasource, but i need all subsequent posts to paginate but the first one to stay the same. so this won't work :(

thanks again! :) daniel

but i need all subsequent posts to paginate

Ah, thought that might be the case.

How is your PHP? If you're comfortable modifying the core you can fiddle around here, which is where the System ID filtering occurs. You'll want to inspect $value, see if it contains your own string, perhaps it starts not:, strip that off and use NOT IN in the query rather than IN. Hacky, but a quick fix.

Thinking of the reflection field some more, I think you might need to use a delimiter. Say you have entry IDs 1 and 10, if you use a filter not-starts-with: 1 then you'll find both entries.

Therefore you could concatenate the reflection field value to __1__ (note the two underscores either side), and then filter like:

not-contains: _1_

(Note the one underscore on either side). This will yield a SQL string like:

NOT(handle LIKE '%_1_%')

Which should work :-)

just wondering if this was ever taken up/implemented.

seems like nick's suggested change was actually implemented in the core; posting in case of future searches.

yeah great. it works this way:

not:{$ds-single-entry.system-id}

what about excluding multiple IDs ?

not: {$id1, $id2}

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details