Excel.LabelFilterCondition enum

Enum representing all accepted conditions by which a label filter can be applied. Used to configure the type of PivotFilter that is applied to the field. PivotFilter.criteria.exclusive can be set to true to invert many of these conditions.

Remarks

[ API set: ExcelApi 1.12 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotfilters.yaml

await Excel.run(async (context) => {
  // Add a PivotFilter to filter based on the strings of item labels.

  // Get the PivotTable.
  const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");

  // Get the "Type" field.
  const field = pivotTable.hierarchies.getItem("Type").fields.getItem("Type");

  // Filter out any types that start with "L" ("Lemons" and "Limes" in this case).
  const filter: Excel.PivotLabelFilter = {
    condition: Excel.LabelFilterCondition.beginsWith,
    substring: "L",
    exclusive: true
  };

  // Apply the label filter to the field.
  field.applyFilter({ labelFilter: filter });

  await context.sync();
});

Fields

beginsWith = "BeginsWith"

Label begins with substring criterion.

Required Criteria: {substring}. Optional Criteria: {exclusive}.

between = "Between"

Between lowerBound and upperBound criteria.

Required Criteria: {lowerBound, upperBound}. Optional Criteria: {exclusive}.

contains = "Contains"

Label contains substring criterion.

Required Criteria: {substring}. Optional Criteria: {exclusive}.

endsWith = "EndsWith"

Label ends with substring criterion.

Required Criteria: {substring}. Optional Criteria: {exclusive}.

equals = "Equals"

Equals comparator criterion.

Required Criteria: {comparator}. Optional Criteria: {exclusive}.

greaterThan = "GreaterThan"

Greater than comparator criterion.

Required Criteria: {comparator}.

greaterThanOrEqualTo = "GreaterThanOrEqualTo"

Greater than or equal to comparator criterion.

Required Criteria: {comparator}.

lessThan = "LessThan"

Less than comparator criterion.

Required Criteria: {comparator}.

lessThanOrEqualTo = "LessThanOrEqualTo"

Less than or equal to comparator criterion.

Required Criteria: {comparator}.

unknown = "Unknown"

LabelFilterCondition is unknown or unsupported.