Episode 1: PropDefObject
|Abbrev||The property definition name (including fully qualified namespace)|
|Cascade||True if the property values are inherited|
|ColumnWidth||The default export column width|
|DataType||A DataType enumeration value, for example DataType.String (see Enumeration Constants)|
|DefaultValue||Default Value of the property definition. The type depends on the data type of the property definition.|
|Global||True if property is a Global Node property|
|Hidden||True if property is hidden from the property grid|
|Level||A PropLevel enumeration value, for example, PropLevel.Node (see Enumeration Constants)|
|List||True if prop lets user select from a list of values|
|ListValues||Array of values from which a user can select|
|LookupValues||Lookup key-value pairs for a lookup property. Use the Key and Value properties of the objects in this array.|
|Namespace||Namespace of property definition|
|PropType||A PropType enumeration value, for example, PropType.Defined (see Enumeration Constants)|
|PropClass||Deriver class (Formula or Script)|
|ReadOnly||True if property is read-only (such as a Core stats property)|
First step is to use the “node” (NodeObject/LocalNodeObject) object and it’s Prop() method to return a NodePropObject. Second step is to use the newly obtained NodePropObject and its GetPropDef() method to in-turn obtain a PropDefObject. Notice how we use a given object to obtain another related object reference? Once you grasp this concept of using an object and its available method(s) to return another object and so on, you will start to understand how to leverage the DRM object model to accomplish some really cool custom-derived properties. If we refer to the first couple lines in the code example below, we could even combine those into a single statement.
Here’s another representation of the same code but combined into a single statement. This might make it easier to see how we’re using objects and their method in almost a daisy-chain fashion to work our way “up” and “down” the object model if you will.
Now that we have our PropDefObject, let’s start working with the properties of this object. Note that this object does not have any methods associated with it. The code example below shows the simple properties that return a single value. The first section shows the code and the second section shows the output.
Generates this output…
Many of these properties are simple boolean values or numbers representing column widths or maximum values. However, some of these numbers represent enumerations or constants. In other words, the numerical value represents a textual value. For example, what the heck does a “PropType” of 2 mean exactly. Too bad the admin guide doesn’t actually list out the index-text pairings. I’ve tested and broken down the enumerations for the different enumeration based properties as shown below.
Now, when you retrieve one of these enumeration type of properties, you can reference this list to see what a given index represents text-wise. For our PropType value of 2, we can see that that equates to a PropType of “Defined”. If we look at our “TEST_PROPERTY” property, we see that indeed the Property Type listed is “Defined”.
That covers the majority of the properties for the PropDefObject. There are still two other properties that are a little more complex in that they return arrays of values instead of a single value. The ListValue and LookupValue properties both return arrays. The former returns a single dimensional array while the LookupValue return a two-dimensional array of key and value pairings.
The next screen shot demonstrates the usage of the ListValue and how to enumerate over its values.
And finally, here’s an example of the LookupValue arrays and enumerating over its key-value pairings.
As you can see, the PropDefObject lets you access almost all settings of a given property (for a given node). The only shortcoming that I’ve come across so far is the inability to access the LookupValues for an external lookup property. Unfortunately, at this time, it doesn’t appear that you can programmatically access the external list for an external lookup property. Oracle are you listening???
Question: Is there a systematic way to compare different properties withing DRM. For example, I have a dimension which has a System alias as well as a Essbase alias. I am trying to determine where there may be something hardcoded causing a variance between the two. Any help is appreciated.
Bookmarked!, I really like your blog!