SheetXL - v1.0.2
    Preparing search index...

    Interface IDataField

    A value of a pivot table: a field summarized by a function.

    A view of the table, found by its caption: what is asked of it after the value is deleted, or after another view has renamed it, throws. Each change lays the table out again from its cache, as one step that can be undone, and a table that grows over cells that hold anything shows #SPILL!.

    interface IDataField {
        isIPivotDataField: true;
        delete(options?: ITransaction.OperationOptions): Promise<void>;
        getCaptionFor(fn: Function): string;
        getField(): IPivotTable.IField;
        getFunction(): Function;
        getName(): string;
        getNumberFormat(): string;
        getPivotTable(): IPivotTable;
        getPosition(): number;
        getShowAs(): ShowAs | null;
        setFunction(
            fn: Function,
            options?: ITransaction.OperationOptions,
        ): Promise<void>;
        setName(
            name: string,
            options?: ITransaction.OperationOptions,
        ): Promise<void>;
        setNumberFormat(
            format: string | number,
            options?: ITransaction.OperationOptions,
        ): Promise<void>;
        setPosition(
            position: number,
            options?: ITransaction.OperationOptions,
        ): Promise<void>;
        setShowAs(
            rule: ShowAs | null,
            options?: ITransaction.OperationOptions,
        ): Promise<void>;
    }
    Index
    isIPivotDataField: true

    For runtime type checking.

    • Takes it off the table.

      Parameters

      Returns Promise<void>

      What names it goes too: a sort by it leaves its items in their listed order, and a value filter and the formats on it are gone for good. Its source stays on any axis it is on. The values field goes below two values, and comes back where it was. A table with nothing left on it is empty again.

    • Returns the caption it would take with fn, as setFunction gives it; its own when fn is its function already.

      Parameters

      Returns string

      value.getName(); // 'Sum of Sales'
      value.getCaptionFor('average'); // 'Average of Sales'

      ExpectedError For a function that is none.

    • Returns the function it summarizes by.

      Returns Function

    • Returns its caption.

      Returns string

    • Returns the format code its values show in.

      Returns string

    • Returns its place among the values, counted from 1.

      Returns number

    • Returns how it is shown; null as it is.

      Returns ShowAs | null

    • Changes the function it summarizes by.

      Parameters

      Returns Promise<void>

      Its caption changes too, a caption typed by hand included, as in Excel: what comes before its first of takes the function's name, a caption with none becomes the function's name and the field's (Average of Sales), and one that is taken is numbered. Its number format stays. Nothing changes when the function is the one it has.

      A value over a calculated field takes the function in name alone, as in Excel: its formula decides what it shows.

      ExpectedError For a function that is none.

    • Changes its caption.

      Parameters

      Returns Promise<void>

      Its source's caption is taken, unless that field has been renamed; so is any other field's, any other value's and the values', without regard to case.

      ExpectedError For a caption taken.

    • Changes the format of its values, over any number format on single cells of them, whose other formats (a fill) stay.

      Parameters

      Returns Promise<void>

      ExpectedError For a format that does not parse.

    • Moves it among the values. A sort, a value filter and the formats on it follow it.

      Parameters

      Returns Promise<void>

      ExpectedError For a position that is not among the values.

    • Changes how it is shown; null shows it as it is.

      Parameters

      Returns Promise<void>

      A kind that reads a base field and is given none reads the one it has, at first the cache's first; every line shows #N/A when that is not on the rows or columns. A new base field starts at its first item. The base stays when the kind changes, and through null.

      The number format changes with the kind, as in Excel. A kind that shows a share takes 0.00% unless it reads as a percent already; a rank or an index drops what it has; going from a share to any other drops a percent format. A format on single cells stays over any of it.

      await value.setShowAs({ kind: 'percentOfTotal' });
      await value.setShowAs({ kind: 'difference', baseField: 'Year', baseItem: '(previous)' });
      await value.setShowAs(null);

      ExpectedError For a kind that is none, or a base field or item that is not the table's.