Professional > Table scripting > Hierarchical data > Using the hierarchical (HDATA) view
 
Using the hierarchical (HDATA) view
When you use the hierarchical (HDATA) view of the data, you can create grid tables, tabulate data in unbounded loops (such as Quanvert levels data), and choose the population level for your tables.
Note The hierarchical view of the data is used by default when the case data is stored in a Quanvert database, an RDB database (provided you are using RDB DSC 2), or in an XML file.
When you use the hierarchical view of the data, the case data schema is defined by the MDM Document.Fields collection and the Document.Variables collection provides a flat list of the columns at the top (HDATA) level only. You specify a variable for use in an axis or filter using the full name of the variable (Variable object). (For variables at the top level, the full names are the same as the full names of the variable instances.)
You can use in an axis variables of the following data types:
Categorical
Long
Double
Date
Boolean
Text
For all these variable types apart from categorical variables that have the properties defined below, at least one element must be defined, either in the Variable.AxisExpression MDM property or in the axis specification.
When you tabulate a categorical variable, the axis will contain all of the elements of the variable, unless an axis expression exists in the metadata or an element list is explicitly specified in the axis specification. When the axis is based on the variable's elements, the variable must have the properties shown in the following table.
Variable property
Valid setting for use in an axis
DataType
mtCategorical
SourceType
sDataField
sExpression
sExpressions
Elements
Must contain at least one Element object
For a numeric loop, the MDM automatically creates elements if the loop is “bounded”, that is, if it has MinValue and MaxValue values specified in the metadata.
When you are using the hierarchical view, you can also use in your axes grids and loops (Grid and Array objects), provided they have at least one iteration. The following table shows the valid values of the relevant properties of the MDM Array object. (A Grid object can be considered a special case of an Array object.)
Array property
Valid setting for use in an axis
Elements
Must contain at least one Element object. For numeric loops (Array objects of type itNumeric or itNumericRanges) the MDM dynamically creates an Element object for each iteration.
See Grid tables for more information.
Note Compounds and blocks (Class objects) are used to group questions for display or convenience only and do not define a true hierarchical structure. Therefore, you cannot use a Compound or Class object directly in an axis. However, you can include the variables (and any Grid or Array objects) that are nested within a Compound or Class object in an axis in the normal way.
The MDM Document.Fields collection is a hierarchical list of the structural objects in the metadata. You can view the objects in the Document.Fields collection in a hierarchical tree view in the UNICOM Intelligence Professional Metadata Viewer, by double-clicking the Document's Fields folder. Each object is shown with an icon that indicates its type.
Loops, grids, compounds, and blocks (Class objects) also have a Fields collection that list their nested objects. Each one of these Fields collections is also visible in the Metadata Viewer as a Fields folder. This means that you can drill down through the objects. For example, by opening a loop's Fields folder, you can explore the variables that are nested inside the loop.
You can use the Properties pane to view a variable's axis expression and the Type property of a loop or grid in order to see whether it is expanded or not. And you can copy the full name of a variable and then paste it into your script.
For more information, see Using the metadata viewer.
See also
Hierarchical data