Search

I've seen this discussed before, but my Google-foo is failing me. I have a feeling regexp may have been the answer, but I've tried a couple things and aren't having any luck.

What's the best approach for creating a Data source filter that gets all values except something? i.e. excludes a value?

Scenario: I need to remove a specific category from a 'latest blog posts' type feed, so I need the Data source to get the 2 most recent entries that do not have a specific value for the 'Category' field. Categories can be created and edited, so I can't hardcode the ones I do want to grab, I can only exclude the category I don't want.

not(category-name)

Oh I tried that… let me investigate!

Hm, have tried with both the value and the handle, i.e. not(category-name) and not(Category Name) and both result in no entries returning, which is unexpected as there are entries that match the criteria of not being that category.

This is on a 2.4 site if relevant.

Ah my bad, it is not-regexp: category-name

Tried both not-regexp: category-name and not-regexp: Category name, this time I have the opposite problem, it seems to just ignore this filter and return entries from all categories :/

I think I tracked down the forum post discussing the issue though (where I originally saw it) and that does appear to be the advertised solution.

This is on a select box (with dynamic values), I have a feeling that's part of the issue.

Category-name needs to be the real name of that category

Oh of course, don't worry, I'm not quite that silly :)

Doesn't seem to be working with the dynamic valued select box though :(

Oh of course, don't worry, I'm not quite that silly :)

Good to know ;-)

Funky, I've just test it with an association field and I could exclude some values. Even not: (we forgot the ":") did the trick.

Also not:ID works, maybe an ID will do it for you?

Good thinking, but no dice :(

Tried not:2 (the ID was 2) on the Category field. That prevents any results from returning.

Specifically this is a select box with dynamic values, rather than a select box link (the predecessor to the Association field). I don't know how that differs to an association field, and I'm also not sure why I ended up doing it that way, I was surprised myself to see that it wasn't a select box link!

I might have to look at changing the filed type, as I'm thinking that's all that could be causing the problem.

Yup, quick test has shown that what you state above works fine on a select box link, but doesn't work on a select box with dynamic values!

I'm going to assume that's a limitation, rather than a bug. Fortunately moving forward I'll just be using the Association field anyway!

Thanks for your patience.

It is the diffence how the relation is stored I guess. SBL keeps the relation and SB just got a string of the values. If I remember it the right way.

Ah and there is the link about that explanation.

I'm not sure that explains the issue actually, as according to that breakdown one of the above options would have worked. I think the way dynamic values are stored in the relationship must differ in normal select boxes.

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