Reference Information for Subject Area Classes
A subject area is analogous to an SQL view of a table. A subject area is a subcube that enables users to focus on smaller sets of data without the need for multiple cubes. A subject area also enables you to customize captions and defaults of the cube.
This page contains reference information for subject area classes.
Also see Using Advanced Features of Cubes and Subject Areas in Advanced Modeling for InterSystems Business Intelligence.
You must recompile a subject area class after making any change.
Also see Accessing the Samples Shown in This Book.
Requirements for a Subject Area Class
To define a subject area, create a class that meets the following requirements:
-
It must extend %DeepSee.SubjectAreaOpens in a new tab.
-
It must contain an XData block named SubjectArea
-
For this XData block, XMLNamespace must be specified as follows:
XMLNamespace = "http://www.intersystems.com/subjectarea"
-
The root element within the XData block must be <subjectArea> and this element must follow the requirements described in the rest of this page.
-
It is useful, but not required, for the class to specify the DependsOn keyword so that this class is compiled only after the cube class is compiled and can be used.
-
The class can define the DOMAIN parameter, which specifies the domain to which any localized strings belong. For example:
Parameter DOMAIN = "PATIENTSAMPLE";
For details, see Performing Localization in Implementing InterSystems Business Intelligence.
For example:
Class BI.Model.SubjectAreas.AsthmaPatients Extends %DeepSee.SubjectArea [DependsOn=Cubes.StudyPatients]
{
/// This XData definition defines the SubjectArea.
XData SubjectArea [ XMLNamespace = "http://www.intersystems.com/deepsee/subjectarea" ]
{
<subjectArea name="AsthmaPatients"
displayName="Asthma Patients"
baseCube="Patients" filterSpec="diagd.h1.diagnoses.asthma" >
</subjectArea>
}
}
Studio provides assistance as you type.
Common Attributes in a Subject Area
Most of the elements in the subject area have the following attributes, which are listed here for brevity:
Attribute | Purpose |
---|---|
name | Logical name of the element as specified in the base cube on which this subject area is based. |
displayName | (Optional) Localized name of this element for use in user interfaces. If you do not specify this attribute, the user interface instead displays the logical name. For details, see Performing Localization in Implementing InterSystems Business Intelligence. |
description | (Optional) Description of this element. If you do not specify this attribute, the user interface instead displays the description specified in the cube definition. |
disabled | (Optional) Controls whether the compiler uses the override defined by this element. If this attribute is "true" then the compiler ignores this override; this is equivalent to commenting out the override. By default, this attribute is "false"
If the override is disabled, then the system uses the definition as given in the cube. |
<subjectArea>
The <subjectArea> element is the root element in the XData block in a subject area class. This element contains the following items:
Attribute or Element | Purpose |
---|---|
name, displayName, description, disabled |
See Common Attributes in a Subject Area earlier in this page.Note that the name attribute must be unique within the InterSystems IRIS® namespace. |
baseCube | Logical name of the cube on which this subject area is based. (This can also be a comma-separated list of logical cube names; see Defining Compound Cubes Advanced Modeling for InterSystems Business Intelligence.) |
owner | (Optional) Name of owner of subject area. |
resource | (Optional) Name of the resource used to control access to this subject area, when it is accessed via the Architect. See the Implementing InterSystems Business Intelligence. |
filterSpec | (Optional) MDX set expression to use as a filter for this subject area. See the subsection Filtering a Subject Area. The default is an empty string so that there is no filtering. |
caption | (Optional) Caption for this subject area. If you do not specify this, the system uses the caption of the base cube instead. |
countMeasureCaption | (Optional) Caption to use for the default measure, which counts records. The default caption is Count. Internally, the name of the measure is %Count. |
defaultListing | (Optional) Specify the logical name of the <listing> to use as the default in this subject area; see <listing>. If you do not specify this, the system uses the default listing as specified in the base cube. |
disableListingGroups | (Optional) Specify this attribute as "true" if you want to prevent anyone from defining a listing group that uses this subject area as a target. The default is "false". See Compiling a Listing Group. |
defaultMember, defaultMeasure | Do not use. |
<measure> | (Optional) You can include zero or more <measure> elements, each of which can hide or customize a measure. |
<dimension> | (Optional) You can include zero or more <dimension> elements, each of which can hide or customize a dimension. |
<listing> | (Optional) You can include zero or more <listing> elements, each of which can hide, customize, or add a listing for this subject area. |
Filtering a Subject Area
The filterSpec attribute enables you to specify a filter that applies to the subject area. This attribute must equal a valid MDX set expression. For example:
{AgeD.H1.[10 to 19],AgeD.H1.[20 to 29]}
See Writing Filter Expressions.
Instead of (or in addition to) specifying filterSpec, you can implement the %OnGetFilterSpec callback; see Filtering a Cube or Subject Area Dynamically in Advanced Modeling for InterSystems Business Intelligence.
<measure>
Within a subject area, a <measure> element hides or customizes a measure. This element has the following attributes:
Attribute | Purpose |
---|---|
name, displayName, description, disabled | See Common Attributes in a Subject Area earlier in this page. |
hidden | (Optional) If hidden="true" then the measure is defined and can be used in queries, but is not listed as an available measure in this subject area. The default is "false". |
formatString | (Optional) If specified, this attribute overrides the formatString attribute specified for this measure in the base cube. See Specifying a Format String. |
You cannot define overrides for calculated measures this way. A calculated measure is actually a calculated member; to define an override for it, you must use <calculatedMember>.
<dimension>
Within a subject area, a <dimension> element hides or customizes a dimension. This element has the following contents:
Attribute or Element | Purpose |
---|---|
name, displayName, description, disabled | See Common Attributes in a Subject Area earlier in this page. |
hidden | (Optional) If hidden="true" then the dimension is defined and can be used in queries, but is not listed as an available dimension. The default is "false". |
allCaption | (Optional) If specified, this attribute overrides the allCaption attribute specified for this dimension in the base cube. |
allDisplayName | (Optional) If specified, this attribute overrides the allDisplayName attribute specified for this dimension in the base cube. |
<hierarchy> | (Optional) You can include zero or more <hierarchy> elements, each of which can hide a hierarchy (or part of a hierarchy). |
<hierarchy>
Within a subject area, a <hierarchy> element hides or customizes a hierarchy. This element has the following contents:
Attribute or Element | Purpose |
---|---|
name, displayName, description, disabled | See Common Attributes in a Subject Area earlier in this page. |
<level> | (Optional) You can include zero or more <level> elements, each of which can hide a level. |
hidden | (Optional) If this attribute is "true" then the hierarchy is not available in this subject area. The default is "false".
If all hierarchies of a dimension are hidden, then the dimension itself will be hidden within the subject area. If you hide a dimension in this manner, the system also hides any calculated members that you might place in the same dimension. |
<level>
Within a subject area, a <level> element hides or customizes a level. This element has the following contents:
Attribute | Purpose |
---|---|
name, displayName, description, disabled | See Common Attributes in a Subject Area earlier in this page. |
hidden | (Optional) If this attribute is "true" then the level is not visible in this subject area. The default is "false". |
sort | (Optional) For a level in a time dimension, this specifies how to sort members of this level by default. Specify either "asc" or "desc"
This attribute has no effect for levels in data or age dimensions. |
<listing>
Within a subject area, a <listing> element hides, customizes, or adds a listing. This element has the following contents:
Attribute | Purpose |
---|---|
name, displayName, description, disabled | See Common Attributes in a Subject Area earlier in this page. |
hidden | (Optional) If this attribute is "true" then the listing is not visible in this subject area. The default is "false". |
other attributes | (Optional) See <listing>. Specify these only if you are redefining a listing or adding a new listing. |
<calculatedMember>
Within a subject area, a <calculatedMember> element hides or customizes a calculated member.
Attribute | Purpose |
---|---|
name, displayName, description, disabled |
See Common Attributes in a Subject Area earlier in this page. |
dimension | Dimension to which this member belongs. |
hidden | (Optional) If this attribute is "true" then the calculated member is not visible in this subject area. The default is "false". |
other attributes | (Optional) See <calculatedMember>. Specify these only if you are redefining or adding a calculated member. |
<namedSet>
Within a subject area, a <namedSet> element hides or customizes a named set. This element has the following contents:
Attribute | Purpose |
---|---|
name, displayName, description, disabled |
See Common Attributes in a Subject Area earlier in this page. |
hidden | (Optional) If this attribute is "true" then the named set is not visible in this subject area. The default is "false". |
other attributes | (Optional) See <calculatedMember> in the previous article. Specify these only if you are redefining or adding a named set. |