OLAPDataArea

Use OLAPDataArea objects to define a data area in an OLAP cube. To create a variable of the type OLAPDataArea, use functions such as OLAPCreateDataArea(). To process the elements in a data area, use the foreach statement.

OLAPConnection con = OLAPCreateNamedConnection("");
OLAPDataArea targetarea = OLAPCreateDataArea(
	con,
	"TFINANC",
	OlapDataAreaIncludeB,
	OlapDataAreaOperatorNone,
	0.0,
	OlapDataAreaOperatorNone,
 0.0
);

When you define data areas, it is key to select the correct cells. You must select at least all the cells that are required. To achieve this, you must specify the elements to process in the first place. In many cases this is sufficient, but sometime you must use more fine-grained mechanisms to restrict your data area. Therefore, you can specify filters and operators.

Use data area filters that depend on the cells' types to restrict the data area. For example, set the filter to OlapDataAreaIncludeB to select only base cells. Set the filter to OlapDataAreaIncludeCIf to select calculated cells. In case you require both types of cells, use the | operator that is shown in this example to combine the filters:

OlapDataAreaIncludeB | OlapDataAreaIncludeC
Note: If your data area contains cells that are calculated through rules, you must set the OLAPDataAreaIncludeC filter. Otherwise, these cells do not become part of the selected data area.

Another important filter is OlapDataAreaSuppressNull, because it removes empty cells from a data area.

In addition, you can use data area operators to restrict cells depending on their values. For example, you can select all cells that meet this condition:

1,000 < x < 10,000

To apply this condition to a data area definition, identify the first value, the first operator, the second value, and the second operator. In this example, the first value is 1,000 and the first operator is < (OlapDataAreaOperatorLessThan). The second value is 10,000 and the second operator also is < (OlapDataAreaOperatorLessThan). Here is an example how it looks like in BI# code:

OLAPConnection con = OLAPCreateNamedConnection("");
OLAPDataArea targetarea = OLAPCreateDataArea(
 con,
 "TFINANC",
 OlapDataAreaIncludeB,
 OlapDataAreaOperatorLessThan,
 1000.0,
 OlapDataAreaOperatorLessThan,
 10000.0
);

We recommend that you always specify your conditions in this form:

[first value] [first operator] x [second operator] [second
value]

Then, to translate the condition into arguments for OLAPCreateDataArea, read them from left side to the right side.