Dynamic property expansion
Navigating the axis tree explains how to reference individual Axis objects in a complex table axis structure.
You can use the mrScriptBasic dynamic property expansion feature to make your script more compact. This example uses the following table axis structure. This is the top axis in the fifth table that is in
Understanding axes.
Complex axis: entrance + gender > (interview + (before > biology))
Some objects in the Table Object Model implement dynamic property expansion. For example, the Axes collection object supports dynamic property expansion of the Item property. This means you can access an item in the collection as if it were a property of the collection object. Therefore:
Set MyTopAxis = MyTable.Axes.Item["Top"]
can be written as
Set MyTopAxis = MyTable.Axes.Top
Dynamic property expansion is implemented in the following objects in the Table Object Model:
▪The Document object dynamically expands the Item property of its Tables property.
▪The Tables object dynamically expands its Item property.
▪The Table object dynamically expands the Item property of its Axes property.
▪The Axes object dynamically expands its Item property.
▪The Axis object dynamically expands the Item property of its SubAxes property.
▪The Elements object dynamically expands its Item property.
▪The Element object dynamically expands the Item property of its SubElements property.
▪The Filters object dynamically expands its Item property.
▪The Exports object dynamically expands its Item property.
▪The Statistics object dynamically expands its Item property.
▪The Statistic object dynamically expands its Properties collection.
This means that using the dynamic property expansion feature on the Elements object, you can write the following:
Set MyElement = _
MyTable.Axes.Item["Top"].SubAxes.Item["gender"]. _
Elements.Item["Male"]
as:
Set MyElement = MyTable.Axes.Item["Top"].SubAxes.Item["gender"].Elements.Male
However, MyTable.Axes.Item["Top"] is also an Axis object. So using the dynamic property expansion on this object, you can write this:
Set MyElement = MyTable.Axes.Item["Top"].gender.Elements.Male
Then, making use of the dynamic property expansion on the Table object, you can rewrite this as:
Set MyElement = MyTable.Top.Gender.Elements.Male
This shows that Axis objects in a complex hierarchy can be accessed using a very compact notation. For example, the biology Axis in the example can be accessed as:
Dim BiologyAxis
Set BiologyAxis = MyTable.Top.Gender.Before.Biology
The dynamic property expansion feature cannot handle axis or element names that contain . (period). For example, you cannot use the dynamic property expansion when referring to an axis called Vehicle.Rating[{Comfort}].Column. This is because the Table Object Model cannot distinguish between a period that is embedded in a name from a period that indicates the beginning of the next property.
See also