All documentation
  • API Reference for older versions
  • FilterObject

    A FilterObject is an object that contains filtering information. It is used for configuring fields in the slice.

    Usage

    To manage filters at runtime, use the setFilter(), getFilter(), and clearFilter() API calls. You can also open the filtering pop-up window by invoking the openFilter() method.

    If you want to preset a filter in your report, we recommend the following approach:

    1. Configure the filter via UI.
    2. Save the report

    Your report will now contain the filter configuration.

    Properties

    Note MDX queries are not supported by the filter. Use only the properties described in this section.

    filter: {
      query: ConditionalQueryObject | ValueQueryObject,
      members: string[],
      exclude: string[],
      include: string[],
      measure: MeasureIdentifierObject
    }
    Property/TypeDescription
    query
    ConditionalQueryObject | ValueQueryObject
    optional Describes a filter by condition or a filter by value.
    To set a filter by condition, specify the query as the ConditionalQueryObject for your field type.
    To set a filter by value, specify the query as the ValueQueryObject. Must be used with the measure property.
    members
    String[]
    optional The field's members to be shown. Example: { "members": ["country.[united states]"] }.
    Must not be used together with query.
    Note that the members filter does not apply to a field with one member.
    If the specified members do not exist, the filter is ignored and all field members are displayed. To change this behavior and show an empty grid, see the Advanced tips guide.
    exclude
    String[]
    optional The field's members to be hidden. Example: { "exclude": ["country.[united states]"] }.
    Can be used together with query (ConditionalQueryObject).
    Note that the exclude filter does not apply to a field with one member.
    include
    String[]
    optional The field's members to be shown in addition to the members returned by the query (ConditionalQueryObject).
    Must be used only together with the query (ConditionalQueryObject).
    For example:
    filter: {
    query: {
    between: ["A", "F"],
    },
    include: ["country.[united states]"]
    }
    measure
    MeasureIdentifierObject
    optional Applies the query (ValueQueryObject) to the specified measure.

    Note members, exclude, and include properties are incompatible with each other and must be used separately.

    Examples

    1) The example below shows how the FilterObject is used to create a conditional filter for a string field:

    slice: {
      rows: [
        {
          uniqueName: "Country",
          filter: {
            query: {
              begin: "U",
            },
          },
        },
      ]
    }

    Live example

    2) The example below shows how the FilterObject is used to create a selection filter:

    slice: {
      rows: [
        {
          uniqueName: "Country",
          filter: {
            members: [
              "country.[poland]",
              "country.[uk]",
              "country.[ukraine]",
            ],
          },
        },
      ]
    }

    Live example

    3) The example below shows how the FilterObject is used to create a value filter:

    slice: {
      rows: [
        {
          uniqueName: "Country",
          filter: {
            measure: {
              uniqueName: "Price",
              aggregation: "sum",
            },
            query: {
              top: 5,
            },
          },
        },
      ]
    }

    Live example

    See also

    Filter by condition
    Filter by selection
    Filter by value
    setFilter()
    clearFilter()