Skip to main content

Dates to Include Filter

When using DirectQuery you may want to only include a subset of data available on the remote database in a manner that the default directQueryDatesFilter does not support. The directQueryDatesFilter bean is used to tell which dates to include (or exclude) from the DirectQuery data node cube. This creates an ICondition that filters the data cube based on the AsOfDate field.

Default Implementation

The default implementation of the directQueryDatesFilter bean will either include or exclude all the dates provided to the DirectQueryDatesFilterSpringProperties configuration properties. The default bean is defined in DirectQueryDatesFilterConfig as:
The DirectQueryDatesFilterConfig class also includes two helper methods that can be used to create simple conditions:

Custom Implementations

To override this bean you need to create a @Bean that returns an com.quartetfs.fwk.filtering.ICondition. This will replace the default directQueryDatesFilter bean with your custom bean.

SubConditions

When creating a custom condition, it is important to ensure each nested condition is wrapped in a SubCondition where the AsOfDate is used as the matching field. Below are some examples.

Examples

Here are some simple examples of how to customize the directQueryDatesFilter bean.

Include All Available Data in DirectQuery

If we wanted to include all data available on our remote database, we simply return null and there will be no condition on what data can be loaded into the DirectQuery data node:

Only Include Specific Dates

In this example, we are giving the DirectQuery data node access to a specific set of dates. Here we do not extend the InitialDataDirectQueryConfig and instead create our own ICondition from scratch to include only the dates we want.

Include Year of Dates

In this example, we are extending the InitialDataDirectQueryConfig and using its helper methods to construct our condition. This will include all dates from the last year up to today.

Include All Data in Database Except This Week

In this example, we are extending the InitialDataDirectQueryConfig and using its helper methods to construct our condition. This will exclude the last seven days (including today) from the DirectQuery data node.