Dimension query with a compound filter and swapped sub-conditions
In this example, variable latitudeAttribute is always on the right side. Therefore, it is not a name of an attribute and it does not imply retrieving or comparing an attribute.
OLAPConnection connection = OLAPCreateNamedConnection("");
string errorMessage = "";
int errorCode = 0;
string sDimension = "Region";
string sHierarchy = "Region";
double latitudeAttribute = 0.0;
string latitudeAttributeName = "Latitude";
string nameAttribute = "Name";
try
{
OLAPElementList list = on connection select all from sDimension
with sHierarchy
where ((-40.0 > latitudeAttribute) or (40.0 < latitudeAttribute))
order by nameAttribute asc, parentcount desc;
foreach (OLAPElement e in list)
{
WriteLine("\t" + ToString(e) + "\t\t\tLatitude: " + OLAPGetDoubleAttribute(connection, e, latitudeAttributeName));
}
}
catch (errorMessage, errorCode)
{
WriteLine("Exception: " + errorMessage);
}
OLAPDisconnect(connection);
The dimension query selects all elements from hierarchy sHierarchy in
dimension sDimension and filters them. The filtering itself compares
double objects -40.0 and 40.0 to a variable
latitudeAttribute. If the latitudeAttribute variable
is not of type double, the code is not valid. If the
latitudeAttribute variable is of type double, the code
is valid. In this example the filtering is independent of all elements and attributes, it is
dependent only on the initial value of latitudeAttribute.