Method calls
OLAPDimension OLAPGetDimension(OLAPConnection conn, string dimName);
with this syntax: OLAPConnection conn = OLAPCreateNamedConnection();
OLAPDimension dim = OLAPGetDimension(conn, "my_dimension");
With method calls, you can shorten this syntax and achieve the same result. To call a method,
requires an instance of an object on which you want to make the operations. In this example,
you must use the object conn
and apply a dot .
operator for method calling. The .
operator gives you all possible options that you can perform on the object.
After you type the operator, you can press CTR+Space and use the IntelliSense auto-completion feature to get a list of all possible methods that can be performed on the object. The list of operations is limited to the specific object.
This is the correct syntax of method calling:
OLAPDimension dim = conn.GetDimension("my_dimension");
Method calls support chaining. That is, you can use the result of a method call for calling another operation:
int dimensionCount = connection.GetCube("ANALYSIS").GetDimensionList().Count();
string dimensionCountAsString = connection.GetCube("ANALYSIS").GetDimensionList().Count().ToString();
Chaining also enables you to eliminate temporary variables. For example, this longer syntax
with the dimList
variable can be shortened:
OLAPConnection connection = CreateTestConnection();
OLAPDimensionList dimList = connection.GetDimensionList();
int iCount = dimList.Count();
With method calls, you can also eliminate the dimList
variable:
int iCount = connection.GetDimensionList().Count()
Example of method calls in SQL
SQLData data1 = conn.ExecuteQuery("SELECT * FROM Test_Table1");
foreach (SQLDataRow row in data1)
{
int id = row.GetInteger("ID");
string fn = row.GetString("FIRST_NAME");
string ln = row.GetString("LAST_NAME");
int ag = row.GetInteger("AGE");
DateTime ll = row.GetDateTime("LAST_LOGIN");
WriteLine(id + "\t" + fn + "\t\t" + ln + "\t\t" + ag + "\t\t" + ToString(ll));
}