2.2.5.3.6 Cache Items
Cache items represent specific instances of the entities represented by cache fields (section 2.2.5.3.5). For example, an instance of a Country cache field might be the USA cache item. Having a USA cache item in the Country cache field enables PivotTable views (section 2.2.5.4) associated with the PivotCache (section 2.2.5.3) to display data by USA.
Each cache item specifies its value and a type. In some cases, a cache item can have additional information associated with it.
A cache item is contained in a cache field. A cache field can have zero cache items if the cache field is not in use in the PivotTable view.
For a cache field that corresponds to source data (section 2.2.5.3.2), a collection of cache items is specified by a collection of sequences of records that conform to the SRCSXOPER rule (section 2.1.7.12), with each cache item being specified by a sequence of records that conforms to the SXOPER rule (section 2.1.7.12), which optionally has a sequence of records that conforms to the SXADDLCACHEITEM rule (section 2.1.7.20.3) associated with it. The sequence of records that conforms to the SXOPER rule specifies the value of the cache item.
For grouping (section 2.2.5.3.7) cache fields, the collection of cache items is specified by a collection of sequences of records that conform to the GRPSXOPER rule (section 2.1.7.12) with each cache item being specified by an SXOPER rule.
Calculated fields (section 2.2.5.3.8) do not contain cache items.
A cache item index can be used to reference a cache item within the cache field. Referencing a cache item by index requires an implicit or explicit reference to that cache field because a cache item collection is associated with a specific cache field. A cache field can be referenced by a cache field index, as specified in section 2.2.5.3.5.
If a collection of GRPSXOPER rules exists in the cache field, a cache item index is a zero-based index into the collection of GRPSXOPER rules. Otherwise, a cache item index is a zero-based index into the collection of SRCSXOPER rules.
There can be multiple entries of source data that have the same combination of value and type for a cache field. Each cache item within a cache field MUST have a unique combination of value and type.
If there is one or more references by index to cache items of a particular cache field, that cache field MUST have a cache items collection. A grouping cache field MUST have a collection of cache items associated with it.
A cache item collection can contain unused cache items.
Unused cache items are values that did not exist in the source data when the PivotCache was last refreshed but existed when the PivotCache was refreshed previously. The PivotCache can retain such unused cache items to preserve information associated with them to reapply that information if the value corresponding to the cache item is added back to the source data at some later point in time.
For an OLAP PivotCache (section 2.2.5.3.4), a cache field associated with an OLAP measure MUST NOT have a cache item collection.
For an OLAP PivotCache, a cache item with a string value specifies the unique name of an OLAP member, unless the cache field is a member property (section 2.2.5.4.6) cache field.
An example of cache items and their association with source data is provided here.
Consider a PivotCache based on the following source data table:
-
Country
Product
Date
Sales
USA
Bicycle
6/5/2007
500
USA
Car
8/3/2007
20000
Canada
Bicycle
9/2/2007
500
Canada
Car
10/5/2007
35000
Four cache fields exist, each corresponding to one of the columns: Country, Product, Date, and Sales. Each of the four cache fields can have cache items corresponding to the unique values in the source data columns as illustrated in the following tables:
-
Cache items for the Country cache field
Canada
USA
-
Cache items for the Product cache field
Bicycle
Car
-
Cache items for the Date cache field
6/5/2007
8/3/2007
9/2/2007
10/5/2007
-
Cache items for the Sales cache field
500
20000
500
35000