Excel.DateFilterCondition enum
日付フィルターを適用できるすべての受け入れられた条件を表す列挙型。 フィールドに適用されるピボットフィルターの種類を構成するために使用します。
注釈
使用元
例
// 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" | 日付が比較子の日付より後である。 必須条件: { |
| afterOrEqualTo = "AfterOrEqualTo" | 日付が比較子の日付より後か同じである。 必須条件: { |
| 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" | 日付が比較子の日付より前です。 必須条件: { |
| beforeOrEqualTo = "BeforeOrEqualTo" | 日付が比較子の日付より前か同じ。 必須条件: { |
| between = "Between" |
必須条件: { |
| equals = "Equals" | コンパレーター条件と等しくなります。 必須条件: { |
| 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" |
|
| yearToDate = "YearToDate" | 日付は同じ年から現在までです。 |
| yesterday = "Yesterday" | 日付は昨日です。 |