Filter Expressions

December 17, 2008 Digital Experience
One of Sitefinity 3.5’s new features is Filter Expressions. These enable you to show content based on conditions, such as publication date, category, and the module’s meta fields. All of the Generic Content Based modules, which include News, Blogs, Events and Images and Documents, support filter expressions.


To access a filter expression, simply drag one of the Generic Content Based modules public controls onto the form, such as a NewsView, click on the advanced tab and then the filter tab. By default, the filter expression filters on a valid publication and expiration date as shown below this sentence:

 
Publication_Date <= "#now" AND Expiration_Date > "#now"

 
You can use filter expressions in a variety of ways and you can combine multiple conditions. For example, you can show all content published before today, with an expiration date that’s valid, where the category is MyCategory and the tag is mytag as shown below this sentence:

 
Publication_Date <= "#now" AND Expiration_Date > "#now" AND Category IN ("MyCategory") AND Tag.Name = "mytag"

 
To filter by specific dates, use this syntax:

 
Event_Start >= "1/1/2008" AND Event_Start < "12/31/2008"

 
Filter Expressions support a variety of SQL operands, joins and conditions. For a full list of them, please review this forum post.

 
You can filter by a variety of fields in the generic content based modules. Using the Events module as an example, you could filter by event start and event end. For a more complete list of fields in the Events Module, please review this article. You could also add and find a list of meta fields by viewing in your Web.config. 

The Progress Team