# Namespace filterFactory

Functions to create date, text, or numeric filters on specified data.

Filters created with these functions can be used to:

  • Filter explicit queries by query components or query functions
  • Filter or highlight queries used by UI components, such as charts
  • Set the filters of filter components

# Example

Example of using React hook useExecuteQuery to query the Sample ECommerce data source. Factory function filterFactory.greaterThan() is used to create a filter on Revenue to get values greater than 1000.

  const { data, isLoading, isError } = useExecuteQuery({
    dataSource: DM.DataSource,
    dimensions: [DM.Commerce.AgeRange],
    measures: [measureFactory.sum(DM.Commerce.Revenue)],
    filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
  });
  if (isLoading) {
    return <div>Loading...</div>;
  }
  if (isError) {
    return <div>Error</div>;
  }
  if (data) {
    return <div>{`Total Rows: ${data.rows.length}`}</div>;
  }
  return null;

# Index

# Functions

# Namespaces