Dimension query with a compound filter

This dimension query selects all elements from the sHierarchy in the sDimension and filters them, by a numeric attribute, which is stored in the variable latitudeAttribute. The attributes with values lower than -40.0 or greater than 40.0 are kept. The remaining elements are ordered by nameAttribute.


	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) or (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);