Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Expand]Views
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Templates
  [Collapse]Filtering
    How to: Filter a Link Dialog's List View
    How to: Filter Large List Views using the Auto Filter Row
    How to: Filter List Views on the UI Specific Level
    How to: Implement Cascading Filtering for Lookup List Views
    How to: Use Function Criteria Operators to Filter List Views
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Use Function Criteria Operators to Filter List Views

The eXpressApp Framework provides various approaches to filter List Views: on data source level, via the Application Model and on the UI specific level. In each of these approaches, you may need to set static variables as filter criteria values. For example, the filter "Task.DueDate must be set to the current date" needs the CurrentDate variable, calculated every time it is required. For this purpose, the use Function Criteria Operators. They represent functions you can use in criteria. In this topic, you will learn how to use these Function Criteria Operators when setting filter criteria for the Task List View. To see a full list of built-in Function Criteria Operators and learn how to implement custom ones, refer to the Function Criteria Operators topic.

Since the technique for using Function Criteria Operators is common to any filtering approach, both in code and the Model Editor, the ListViewFilterAttribute will be chosen for demonstration.

Note

Before reviewing the example, be sure to read the "Important Remark on the DateTime Function Criteria Operators" section of the Function Criteria Operators topic.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E3936.

The following code demonstrates how to implement various filters using the LocalDateTimeToday, LocalDateTimeLastWeek and LocalDateTimeThisWeek Function Criteria Operators:

The code above generates several Filter child nodes for the Application Model's Views | Task_ListView node:

Note

You could generate these nodes manually in the Model Editor.

The following image demonstrates the Filter Action that contains all the filters provided by the code above:

How would you rate this topic?​​​​​​​