Starting with version 2025.2, Stimulsoft products for dashboard creation introduced the InclusionMode property, which we will explore in this article.
Introduction
The InclusionMode property allows you to control the behavior of filters when working with related data. Using this property can help resolve subtle issues that arise when applying filters to aggregated data.A possible data usage scenario in a dashboard
Let's consider a scenario where a dashboard uses two data sources: Categories and Products.Without a filter, the product table displays only actual data from the source. If there are more categories than matching entries in the product data, then after aggregation (e.g., summing), a row appears with data from categories that have no match in the products.
With a filter (e.g., by category), a condition related to the category column is added to the table query.
The problem: When selecting the "All" option in the filter, the row with aggregated data disappears, which is incorrect behavior. Important!
The issue arises because there are multiple ways to join tables, and selecting the "All" option triggers a FULL JOIN mechanism. You can read more about join types and the JoinType property in this article. The InclusionMode property addresses this issue by offering two modes for filter behavior.
Filter modes
Let’s take a look at how each mode works:Default (Selection Only):
The filter is activated only when a specific category is selected.
If “All” is selected, the filter is not added to the query → the row with aggregated data disappears.
Always:
The filter is always added to the query, even when the “All” option is selected.
In this case, the row with aggregated data is preserved, since the filter condition (e.g., WHERE CategoryID IS NULL) remains in the query.
Thus, the Always value is used when aggregated data (such as totals) should be retained even when “All” is selected, while Selection Only is used when the filter should apply only when an explicit selection is made (e.g., for query optimization).
Advantages of using the InclusionMode property
- Control over aggregated dataThe property eliminates “jumping” rows when filters with the “All” option are used.
- Predictability
The Always mode guarantees that the filter will affect the query even when “All” is selected.
- Compatibility
The Selection Only mode preserves the behavior familiar to users of earlier versions.