Hierarchy support in dimension queries

The syntax of dimension queries supports hierarchies. You can select elements from a non-default hierarchy.

The hierarchy name can be specified by a string literal or a string variable. To specify a hierarchy, use the with keyword.

Example of using a dimension query to select elements from a non-default hierarchy


	OLAPConnection connection = OLAPCreateNamedConnection("");

	string errorMessage = "";
	int errorCode = 0;

	string sDimension = "Product";
	string sHierarchy = "Speed rating";
	string nameAttribute = "NAME";

	try
	{
		OLAPElementList list = on connection select all from sDimension with sHierarchy;
		foreach (OLAPElement e in list)
		{
			WriteLine("\t" + ToString(e));
		}
	}
	catch (errorMessage, errorCode)
	{
		WriteLine("Exception: " + errorMessage);
	}

	OLAPDisconnect(connection);

If no hierarchy is specified, the default hierarchy is used. It throws an exception if a hierarchy that does not exist is specified.