Professional > Table scripting > Table specification syntax > Understanding axes > Dynamic property expansion
 
Dynamic property expansion
Navigating the axis tree explains various techniques that you can use to reference individual Axis objects within a complex table axis structure. In this topic, we will look at using the mrScriptBasic dynamic property expansion feature to make your script more compact. We shall use the following table axis structure as an example. (This is the top axis in the fifth table discussed in Understanding axes.)
Complex axis: entrance + gender > (interview + (before > biology))
A number of 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, we can write this:
Set MyElement = MyTable.Axes.Item["Top"].gender.Elements.Male
Then, making use of the dynamic property expansion on the Table object, we 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 above example can be accessed as:
Dim BiologyAxis
Set BiologyAxis = MyTable.Top.Gender.Before.Biology
Note 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
Understanding axes