Skip to main content
Home  ›  Docs › Feature

ValueFilter DataSource to filter content-items based on values

Warning ⚠️: New Docs Available

These are old docs and we haven't found the time to completely move them. You will find comprehensive new docs on docs.2sxc.org.

Introduced in Version 07.00.00

This filter is fairly straight forward. It let's you filter the items to only retrieve the ones that adhere to your needs. 

I'll write more about it some day, but here just the important specs.

Common Uses

  1. On details-views you often want to find an item with an "id" corresponding to the [QueryString:id] or a "Url" corresponding to [QueryString:Blog]
  2. When showing a list of items you may want to filter them by a criteria like "Color"
  3. When showing a list of items you you might want to limit it to all, which are in the future (events) or in the past (news, blog)

The Fields

  1. Attribute - the name of the field you will want to filter on
  2. Value - the value you want to find, for example "Green"; you'll often use tokens like [QueryString:id] or [DateTime:Now]
  3. Operator - how to compare the data with the desired values, like "==" or "contains"; the operators that work depend on the type of data, listed below
  4. Take - how many to retrieve; leave blank to get all, or 1, 7 whatever to get just the first few hits. Will improve the performance a bit.

The Operators (since v8.5)

Operators for all Types

  • all - will deliver everything, basically it doesn't apply the filter. This is great if you have cases where you don't filter, and cases where you do
  • none - will deliver nothing, basically it provides an empty list

String Operators

  • == will do a case-insensitive compare
  • === will do a case-sensitive compare
  • != will check if it's not equal, case insensitive
  • begins will check if it begins with this
  • contains will check if it contains this
  • !contains will check if it doesn't contain this

Boolean Operators

  • == will check if it's equal case insensitive (so true TRUE True are all true)
  • === will do the same for now
  • != will check if it's not equal, again case-insensitive

Number Operators

  • == will check if equal; after converting the numbers to decimal format - so "2" is == to "2.0"
  • === is the same as "=="
  • != not equal, again after neutralizing to decimal format
  • > greater than - so the value in the content-item is greater than the compare-value
  • < smaller than
  • >= greater or equal than
  • <= smaller or equal than
  • between - to check if something is between two values to use this, do something like "7 and 10" in the value you are comparing against, or "[QueryString:Min] and [QueryString:Max]"
  • !between - opposite of between, also use the "x and y" syntax in the value

DateTime Operators

  • == will check if equal; after converting the numbers to an internal date format - so "2015-02-07" is == "7/2/2015"
  • === is the same as "=="
  • != not equal, again after neutralizing to date format
  • > greater than - so the value in the content-item is greater than the compare-value
  • < smaller than
  • >= greater or equal than
  • <= smaller or equal than
  • between - to check if something is between two values to use this, do something like "2015-01-01 and 2016-01-01" in the value you are comparing against, or "[QueryString:Min] and [QueryString:Max]"
  • !between - opposite of between, also use the "x and y" syntax in the value