Using Table Filters

Table Filters

Table filters are applied per report element only, to report elements with a table structure, so not all report element types are supported. Table filters can be edited in Config/Reports per report element on the Filters tab.

Table filters are similar to report filters, though table filters are applied to query result tables. A table filter expression applies to all rows of a table, it is executed row per row. If the expression is set to true, then the row will be shown in the final output.

Table filter expressions uses the cell_by_name () or cell_by_row_number and name() functions to refer to a specific table column by defining the report field name in the syntax.

cell_by_name('report_field_name') cell_by_row_number_and_name(row_number, 'report_field_name')

A table filter expression must evaluate to boolean true or false. If the expression evaluates to true, the row will be shown, if false it will be hidden.

For instance:

  • Show only table rows with more than 20 visitors cell_by_name('visitors') > 20
  • Show only table rows where the page names contain the string "product", with 20 or more page_views and with 10 or more visitors. This contains: cell_by_name('page), 'product') and (cell_by_name('page_views') > 20) and (cell_by_name('visitors') > 10)
  • Advantages of table filters over report filters

    Table filters are applied to the aggregated values of numerical fields, rather than values from the database. This makes it possible to do filtering which cannot be done with report filters. For instance, in the database, every row in a web log is one visitor, so you can't use log filters or report filters to select "page views >10". But in report tables, the page views have been aggregated before the filtering occurs, so you can use "page view > 10" to select all table items which have more than 10 page views, total.

    Report field and table filter expression syntax

    Report field and table filter expressions are composed of:

  • the Salang syntax
  • the cell_by_name() or cell_by_row_number_and_name() subroutine to get the value form other table cells
  • the global variables row_number and number_of_days
  • cell_by_name(report field ID)

  • cell_by_name() returns the value of the table cell with the given report field ID (each report field is identified by an ID, the ID is equal to the report field node name). For instance: (cell_by_name('hits') * cell_by_name('page_views')
  • cell_by_row_number_and_name(row_number, report field ID)

  • cell_by_row_number_and_name returns the value of the table cell with the given row_number and report field ID.
  • The row_number argument allows you to get the table cell value from other rows, i.e. the previous row or next row.
  • The global variables row_number and number_of_days

  • These two variable may be useful for very specific expression requirements. row_number in an integer of the current processed row. It is useful when using cell_by_row_number_and_name() to get the row number of a previous or next row.
  • number_of_days is an integer of the current days in the filtered date range.