ExcelScript.ValueFilterCondition enum

表示可应用值筛选器的所有接受条件的枚举。 用于配置应用于字段的 PivotFilter 的类型。 PivotFilter.exclusive 可以设置为 以 true 反转其中许多条件。

注解

示例

/**
 * This script applies a PivotValueFilter to the first row hierarchy in the PivotTable.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the PivotTable on the current worksheet.
  let sheet = workbook.getActiveWorksheet();
  let pivotTable = sheet.getPivotTables()[0];

  // Get the first row hierarchy to use as the field which gets filtered.
  let rowHierarchy = pivotTable.getRowHierarchies()[0];

  // Get the first data hierarchy to use as the values for filtering the rows.
  let dataHierarchy = pivotTable.getDataHierarchies()[0];

  // Create a filter that excludes values greater than 500.
  let filter: ExcelScript.PivotValueFilter = {
    condition: ExcelScript.ValueFilterCondition.greaterThan,
    comparator: 500,
    value: dataHierarchy.getName()
  };

  // Apply the filter.
  rowHierarchy.getPivotField(rowHierarchy.getName()).applyFilter({
    valueFilter: filter
  });
}

字段

between

在 和 upperBound 条件之间lowerBound

必需条件: {valuelowerBoundupperBound}。 可选条件:{exclusive}

bottomN

在底部 N (threshold) 值类别的 [items, percent, sum] 。

必需条件: {valuethresholdselectionType}

equals

等于比较器条件。

必需条件: {valuecomparator}。 可选条件:{exclusive}

greaterThan

大于比较器条件。

必需条件: {valuecomparator}

greaterThanOrEqualTo

大于或等于比较器条件。

必需条件: {valuecomparator}

lessThan

小于比较器条件。

必需条件: {valuecomparator}

lessThanOrEqualTo

小于或等于比较器条件。

必需条件: {valuecomparator}

topN

在前 N 个 (threshold) 值类别的 [items, percent, sum]。

必需条件: {valuethresholdselectionType}

unknown

ValueFilterCondition 未知或不受支持。