HotXLS Docs

Non-OLAP Pivot Slicer selection

Version 2.384.88 adds typed member selection to imported non-OLAP Pivot Slicer caches that can be bound to ordinary local cache fields and their connected PivotTable views

Inspect and change a selection

SlicerCache := Workbook.SlicerCaches.FindByName('SlicerCategory');
if (SlicerCache = nil) or not SlicerCache.IsNonOlapPivot then
  raise Exception.Create('A non-OLAP Pivot Slicer cache is required');
if SlicerCache.SetSelectedItems([1]) <> 1 then
  raise Exception.Create('Slicer selection could not be changed');

TXLSXSlicerCache.IsNonOlapPivot identifies the tabular Pivot shape; TXLSXSlicerCache.ItemCount, TXLSXSlicerCache.ItemCacheIndex, and TXLSXSlicerCache.ItemSelected expose the parsed member list and selection

Member-list positions are zero-based; each ItemCacheIndex identifies a shared member in the bound Pivot cache field, so number, text, Boolean, date, blank, and error members retain separate identities even when their displayed text matches

TXLSXSlicerCacheItem stores a CacheItemIndex: Integer and Selected: Boolean; TXLSXSlicerCacheItems is its dynamic-array type, while the cache exposes selection through read-only indexed properties

TXLSXSlicerCache.SetSelectedItems takes shared-member indices and returns 1 on success or -1 for unsupported, invalid, or unsafe bindings; an empty selection is rejected because the file format requires at least one selected member

TXLSXSlicerCache.ClearSelection returns the same status convention and selects all members; it removes this Slicer constraint while keeping independent restrictions on other fields

Shared views and existing filters

Selected members within one Slicer cache form a union; applicable Slicer caches intersect for each explicitly connected view, including when the selected field is absent from that view's displayed axes; multiple UI Slicer views of one cache share the same selection

Call TXLSPivotTable.Make with the application's result writer to compute current results; cache selection changes do not rewrite worksheet cells or regenerate every imported native layout

Excel stores non-OLAP Slicer selections as ordinary Pivot member hiding and page selection; the format does not record which operation created an individual hidden flag

Before modifying an imported binding, HotXLS validates that its old same-field hidden and page masks match the effective old Slicer selection; matching masks are treated as Slicer-managed, while inconsistent or ambiguous masks are rejected without guessing; unrelated-field manual, page, and advanced filters remain active

Saving and source refresh

Saving updates the Slicer selection and connected Pivot member masks together, keeps imported XML namespaces and unknown extensions, and remaps sheet connections to their saved identities; extended Slicer cache identifiers remain distinct from ordinary workbook Pivot cache identifiers

Local Pivot cache refresh retains selected shared-member indices; explicit subsets exclude new members, while cleared selections allow the complete refreshed domain

Boundaries and failure behavior

Selection changes validate all connected views and members before commit and use the workbook's mutation guard; failure preserves the existing selection, view restrictions, and original XML

Adding, deleting, and clearing Slicer caches also use the workbook's write guard; a frozen workbook view cannot change connected Pivot results through collection mutation

Deleting a bound non-OLAP Pivot cache, or clearing a collection containing one, is rejected before mutation; the explicit RemoveSlicerCache lifecycle operation removes its native views and either clears or transfers its selection to ordinary Pivot masks

OLAP and table-cache selection, grouped or calculated source fields, missing connections, inconsistent domains, and ambiguous imported same-field masks remain outside this operation; unsupported cache contents retain their original representation

This selection API handles imported and supported authored Pivot Slicer caches; shared-view authoring and explicit cache removal are available in 2.384.94; safe worksheet materialization can replace supported calculated output, while cross-filter no-data display evaluation remains separate work

Deleting the last UI view of a bound non-OLAP cache is rejected before changing its drawing, view, or cache; deleting one of several UI views retains their shared cache and selection

Clearing a worksheet's Slicer views checks every affected cache before removing any view; a final bound view causes atomic rejection, while views shared with other worksheets retain their cache and selection

Additional record filters

TlxPivotRecordFilter = function(ATable: TXLSPivotTable;
  ARecordIndex: Integer): Boolean of object;
procedure TXLSPivotTable.SetRecordFilter(AOwner: TObject;
  AFilter: TlxPivotRecordFilter);
procedure TXLSPivotTable.ClearRecordFilter(AOwner: TObject);
property TXLSPivotTable.ExternalRecordFilter: TlxPivotRecordFilter;

TXLSPivotTable.SetRecordFilter registers or replaces one callback per non-nil owner, and TXLSPivotTable.ClearRecordFilter removes that owner's callback; passing a nil callback to SetRecordFilter also removes it

Registered callbacks and the optional TXLSPivotTable.ExternalRecordFilter intersect before the table's own filters and aggregation; the workbook registers its Slicer callback independently, so it does not overwrite the caller's predicate

Callbacks receive zero-based record indices, are snapshotted for each Make call, and are not serialized or copied by AssignPivotOnly; owners and callback targets remain caller-owned and must outlive their registration