Dimension query with all clauses
This example shows that all elements from the hierarchy sHierarchy
in the dimension sDimension
are selected. The elements are filtered by a numeric attribute. All elements, where the numeric attribute value is greater than 40.0 are kept, other are filtered out. The remaining elements are first ordered by the nameAttribute asc
and then by the parentcount desc
. The result is stored in the list variable.
OLAPConnection connection = OLAPCreateNamedConnection("");
string errorMessage = "";
int errorCode = 0;
string sDimension = "Region";
string sHierarchy = "Region";
string latitudeAttribute = "Latitude";
string nameAttribute = "Name";
try
{
OLAPElementList list = on connection select all from sDimension
with sHierarchy
where (latitudeAttribute > 40.0)
order by nameAttribute asc, parentcount desc;
foreach (OLAPElement e in list)
{
WriteLine("\t" + ToString(e) + "\t\t\tLatitude: " + OLAPGetDoubleAttribute(connection, e, latitudeAttribute));
}
}
catch (errorMessage, errorCode)
{
WriteLine("Exception: " + errorMessage);
}
OLAPDisconnect(connection);