Referencing list objects

List objects are named ListViewN, where N is a sequential number.

Use the name to reference the object in formulas. For example, the formula =ListView3.attribute returns an attribute of the object.

You can rename objects to make them easier to identify when defining actions, for example.

This table shows the attributes of list objects that can be displayed:

Name Function Example
=ListView[No].Alias Displays the caption of a list element All Stores
=ListView[No].Text Displays the unique name of the list element [Store].[All Stores]
=ListView[No].Attribute Displays an attribute of the list element. The attribute must first be selected in the Attributes pane of the List Designer
=ListView[No].ElementCount Returns the number of elements displayed by the ListView object. It increases and decreases as the list is expanded and collapsed
=ListView[No].ElementIndex Returns the position in the list of whichever element is selected
=ListView[No].Set Returns the MDX of a list, in Design Mode only
=ListView[No].StructureSet Returns the MDX of the structure selection of a list, in Design Mode only

ElementCount and ElementIndex

  1. In Design mode, link a list to a list object other than a hyperblock.
  2. Click an adjacent cell and specify =ListViewN.ElementCount.
  3. In another cell, specify =ListViewN.ElementIndex.

In View mode, the element count increases and decreases as the list is expanded and collapsed. The element index changes as you select different elements in the list.

Set and StructureSet

This example uses the Samples application.

  1. Drag the Product dimension from the SALES cube onto the worksheet to create a hyperblock.
  2. In the List Designer select the All Tires check box in Structure Selection.
  3. In a worksheet cell, specify =[hyperblock_name].Set.
    The cell displays the MDX of the list:
    Distinct({{[PRODUCT].[All Tires]}})
    	 
  4. In another cell, specify =[hyperblock name].StructureSet

The cell displays the MDX of the structure selection:

{{[PRODUCT].[All Tires]}}