Excel.DateFilterCondition enum

日付フィルターを適用できる、受け入れられるすべての条件を表す列挙型。 フィールドに適用される PivotFilter の種類を構成するために使用します。

注釈

[ API セット: ExcelApi 1.12 ]

// 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 date-based PivotFilter.

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

  // PivotFilters can only be applied to PivotHierarchies that are being used for pivoting.
  // If it's not already there, add "Date Updated" to the hierarchies.
  let dateHierarchy = pivotTable.rowHierarchies.getItemOrNullObject("Date Updated");
  await context.sync();
  if (dateHierarchy.isNullObject) {
    dateHierarchy = pivotTable.rowHierarchies.add(pivotTable.hierarchies.getItem("Date Updated"));
  }

  // Apply a date filter to filter out anything logged before August.
  const filterField = dateHierarchy.fields.getItem("Date Updated");
  const dateFilter = {
    condition: Excel.DateFilterCondition.afterOrEqualTo,
    comparator: {
      date: "2020-08-01",
      specificity: Excel.FilterDatetimeSpecificity.month
    }
  };
  filterField.applyFilter({ dateFilter: dateFilter });

  await context.sync();
});

フィールド

after = "After"

Date はコンパレータの日付の後です。

必須の条件: {comparator}。 オプションの条件: {wholeDays}

afterOrEqualTo = "AfterOrEqualTo"

日付はコンパレータの日付の後または等しい。

必須の条件: {comparator}。 オプションの条件: {wholeDays}

allDatesInPeriodApril = "AllDatesInPeriodApril"

日付は 4 月です。

allDatesInPeriodAugust = "AllDatesInPeriodAugust"

日付は 8 月です。

allDatesInPeriodDecember = "AllDatesInPeriodDecember"

日付は 12 月です。

allDatesInPeriodFebruary = "AllDatesInPeriodFebruary"

日付は 2 月です。

allDatesInPeriodJanuary = "AllDatesInPeriodJanuary"

日付は 1 月です。

allDatesInPeriodJuly = "AllDatesInPeriodJuly"

日付は 7 月です。

allDatesInPeriodJune = "AllDatesInPeriodJune"

日付は 6 月です。

allDatesInPeriodMarch = "AllDatesInPeriodMarch"

日付は 3 月です。

allDatesInPeriodMay = "AllDatesInPeriodMay"

日付は 5 月です。

allDatesInPeriodNovember = "AllDatesInPeriodNovember"

日付は 11 月です。

allDatesInPeriodOctober = "AllDatesInPeriodOctober"

日付は 10 月です。

allDatesInPeriodQuarter1 = "AllDatesInPeriodQuarter1"

日付は四半期 1 です。

allDatesInPeriodQuarter2 = "AllDatesInPeriodQuarter2"

日付は四半期 2 です。

allDatesInPeriodQuarter3 = "AllDatesInPeriodQuarter3"

日付は四半期 3 です。

allDatesInPeriodQuarter4 = "AllDatesInPeriodQuarter4"

日付は四半期 4 です。

allDatesInPeriodSeptember = "AllDatesInPeriodSeptember"

日付は 9 月です。

before = "Before"

Date はコンパレータの日付より前です。

必須の条件: {comparator}。 オプションの条件: {wholeDays}

beforeOrEqualTo = "BeforeOrEqualTo"

日付がコンパレータの日付の前または等しい。

必須の条件: {comparator}。 オプションの条件: {wholeDays}

between = "Between"

の間 lowerBoundupperBound 日付。

必須の条件: {lowerBound, upperBound}. 省略可能な条件: {wholeDays, exclusive}.

equals = "Equals"

比較条件に等しい。

必須の条件: {comparator}。 省略可能な条件: {wholeDays, exclusive}.

lastMonth = "LastMonth"

日付は先月です。

lastQuarter = "LastQuarter"

日付は最後の四半期です。

lastWeek = "LastWeek"

日付は先週です。

lastYear = "LastYear"

日付は最後の年です。

nextMonth = "NextMonth"

日付は来月です。

nextQuarter = "NextQuarter"

日付は次の四半期です。

nextWeek = "NextWeek"

日付は来週です。

nextYear = "NextYear"

日付は来年です。

thisMonth = "ThisMonth"

日付は今月です。

thisQuarter = "ThisQuarter"

日付はこの四半期です。

thisWeek = "ThisWeek"

日付は今週です。

thisYear = "ThisYear"

日付は今年です。

today = "Today"

日付は今日です。

tomorrow = "Tomorrow"

日付は明日です。

unknown = "Unknown"

DateFilterCondition が不明であるか、サポートされていません。

yearToDate = "YearToDate"

日付は、現在と同じ年です。

yesterday = "Yesterday"

日付は昨日です。