次の方法で共有


ExcelScript.PivotValueFilter interface

PivotField に適用する値フィルターの構成可能なテンプレート。 は condition 、フィルターを動作させるために設定する必要がある条件を定義します。

注釈

/**
 * 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
  });
}

プロパティ

comparator

コンパレータは、他の値が比較される静的な値です。 比較の種類は条件によって定義されます。 たとえば、コンパレータが "50" で条件が "greaterThan" の場合、50 を超えないすべての項目値がフィルターによって削除されます。

condition

必要なフィルター条件を定義するフィルターの条件を指定します。

exclusive

の場合true、フィルターは条件を満たす項目を除外します。 既定値は (条件を満たす項目を含むフィルター) です false

lowerBound

フィルター条件の範囲 between の下限。

selectionType

フィルターが上位/下位 N 個の項目、上位/下位 N%、または上位/下位の N 個の合計を対象とするかどうかを指定します。

threshold

上位/下位のフィルター条件に対してフィルター処理される項目数、パーセント数、または合計の "N" しきい値。

upperBound

フィルター条件の範囲の between 上限。

value

フィルター処理するフィールドで選択した "値" の名前。

プロパティの詳細

comparator

コンパレータは、他の値が比較される静的な値です。 比較の種類は条件によって定義されます。 たとえば、コンパレータが "50" で条件が "greaterThan" の場合、50 を超えないすべての項目値がフィルターによって削除されます。

comparator?: number;

プロパティ値

number

condition

必要なフィルター条件を定義するフィルターの条件を指定します。

condition: ValueFilterCondition;

プロパティ値

exclusive

の場合true、フィルターは条件を満たす項目を除外します。 既定値は (条件を満たす項目を含むフィルター) です false

exclusive?: boolean;

プロパティ値

boolean

lowerBound

フィルター条件の範囲 between の下限。

lowerBound?: number;

プロパティ値

number

selectionType

フィルターが上位/下位 N 個の項目、上位/下位 N%、または上位/下位の N 個の合計を対象とするかどうかを指定します。

selectionType?: TopBottomSelectionType;

プロパティ値

threshold

上位/下位のフィルター条件に対してフィルター処理される項目数、パーセント数、または合計の "N" しきい値。

threshold?: number;

プロパティ値

number

upperBound

フィルター条件の範囲の between 上限。

upperBound?: number;

プロパティ値

number

value

フィルター処理するフィールドで選択した "値" の名前。

value: string;

プロパティ値

string