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 = OLAPCreateConnection(
	"server",
	"user",
	"password"
);
OLAPDataArea targetarea = OLAPCreateDataArea(
	con,
	"TFINANC",
	OlapDataAreaIncludeB,
	OlapDataAreaOperatorNone,
	0.0,
	OlapDataAreaOperatorNone,
 0.0
);

When you define data areas, it is key to select the right cells. You must select at least all the cells you actually need. To achieve this, you must specify the elements to process in the first place. In many cases this is sufficient, but sometime you need 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, you can combine the filters by using the | operator shown in this example:

OlapDataAreaIncludeB | OlapDataAreaIncludeC
Note: If your data area contains cells that are calculated by using rules, you must set the OLAPDataAreaIncludeC filter. Otherwise, these cells will not be 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 when defining a data area, you must 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 = OLAPCreateConnection(
 "server",
 "user",
 "password"
);
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 you can translate the condition into arguments for OLAPCreateDataArea by reading them from left to right.