ExcelScript.ShowAsRule interface

Comentários

Exemplos

/**
 * The script changes the display for "Crates Sold at Farm".
 * The field shows each value's difference
 * from the value of the "Lemon" in the same row.
 * If the row has no value for "Lemon", the field shows "#N/A".
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the PivotTable named "Farm Pivot".
  const farmPivot = workbook.getPivotTable("Farm Pivot");

  // Get the data hierarchy "Sum of Crates Sold at Farm".
  const farmSales = farmPivot.getDataHierarchy("Sum of Crates Sold at Farm");

  // Get the row hierarchy "Type".
  const typeField = farmPivot.getRowHierarchy("Type").getFields()[0];

  // Change the data hierarchy to show each value as the difference
  // from the value of the "Lemon" in that row.
  const rule: ExcelScript.ShowAsRule = {
    calculation: ExcelScript.ShowAsCalculation.differenceFrom,
    baseField: typeField,
    baseItem: typeField.getPivotItem("Lemon")
  }
  farmSales.setShowAs(rule);

  // Set the name of the field to match the new behavior.
  farmSales.setName("Difference from Lemons of Crates Sold at Farm");
}

Propriedades

baseField

O PivotField para basear o ShowAs cálculo em, se aplicável de acordo com o ShowAsCalculation tipo, em outra .null

baseItem

O item no qual basear o ShowAs cálculo, se aplicável de acordo com o ShowAsCalculation tipo, em outro null.

calculation

O ShowAs cálculo a ser usado para o PivotField. Confira ExcelScript.ShowAsCalculation detalhes.

Detalhes da propriedade

baseField

O PivotField para basear o ShowAs cálculo em, se aplicável de acordo com o ShowAsCalculation tipo, em outra .null

baseField?: PivotField;

Valor da propriedade

baseItem

O item no qual basear o ShowAs cálculo, se aplicável de acordo com o ShowAsCalculation tipo, em outro null.

baseItem?: PivotItem;

Valor da propriedade

calculation

O ShowAs cálculo a ser usado para o PivotField. Confira ExcelScript.ShowAsCalculation detalhes.

calculation: ShowAsCalculation;

Valor da propriedade