What is a Filter?

A filter can limit dimension values and summary values. In DiveTab, filters can either be applied to the build, cplan, or divetab file through Workbench.

When a filter is applied to a build file, the build result includes the filter. When a filter is applied to a cPlan, every instance where the cPlan is implemented uses that filter. When a filter is applied to a data page or element, the filter is used in only those instances.

Here is a Closedfilter used in a Build file.

  build {
    cbase-input "/cbases/sales.cbase" { 
      filter ``` 
      value("Year") = "2017" or 
      value("Year") = "2016" or 
      value("Year") = "2014"
      ``` 
    } 
    cbase-input "/cbases/aop.cbase" { 
      filter `value("Year") = "2015"` 
    } 
    output "/cbases/sales_and_aop.cbase" 
  } 

Every time the specified cBase is used, the filters apply.

Here is a Closedfilter used in a cPlan file.

  cplan { 
    // Read a cBase or another cPlan like this: 
    cbase-input "/cbases/NY.cbase" 
    filter `value("Resp SalesPerson") = "Tony"` 
  } 

Every time this cplan is used, this filter applies. Only data for Resp SalesPerson dimension value Tony is presented.

Here is a Closedfilter applied to the cPlan of a report-page block.

  report-page { 
    title "Basic Report Page" 
    cplan "/cplans/basic_101.cplan" { 
      filter `value("Resp SalesPerson") = "Tony"` 
    } 
    filter `value("9 Liter Cases") > 100` 
    dimension "Resp SalesPerson" 
    dimension "Corporate Brand" 
    text "9L Cases" column = "9 Liter Cases" 
  } 

Notice how the filters are applied within the report-page block. This means that only that particular report page is affected. Only values greater than 100 for 9 Liter Cases are shown for Resp Salesperson value Tony.

NOTE: When the line of code for the expression is too long, the normally single backtick, `, can be replaced with three backticks, ```, in order to divide the code between several lines.

The different types of filters can be sorted into two categories:

  • Filters applied to dimension values (including dates, such as year and period of time)
  • Filters applied to summary values

NOTE: Make sure that the dimension value is exactly as it appears in the cPlan or the cBase; values are case-sensitive—if they do not match what is in the script, they do not display.