Command(Text: String): IDalCommand;
Command(Text: string): Prognoz.Platform.Interop.Dal.IDalCommand;
Text.The MDX query text, with which the object is initialized.
The Command method initializes an object that enables the user to work with server with the MDX queries.
Executing the example requires that the repository contains an ADOMD catalog with the ADOMDTest identifier.
Sub UserProc;
Var
MB: IMetabase;
Catalog: IAdoMdCatalogInstance;
Connection: IAdoMdConnection;
sMDX: String;
Command: IDalCommand;
ResultCursor: IDalCursor;
CFields: IDalCursorFields;
CField: IDalCursorField;
i: Integer;
Begin
MB := MetabaseClass.Active;
Catalog := MB.ItemById("ADOMDTest").Open(Null) As IAdoMdCatalogInstance;
Connection := Catalog.Connection;
sMDX := "SELECT ...";
Command := Connection.Command(sMDX);
//MDX query execution
Command.Execute;
//Obtaining execution results
ResultCursor := Command.CreateCursor;
CFields := ResultCursor.Fields;
While Not ResultCursor.Eof Do
For i := 0 To CFields.Count - 1 Do
CField := CFields.Item(i);
Debug.WriteLine(CField.Name + " | " + CField.Value);
End For;
ResultCursor.Next;
End While;
End Sub UserProc;
The command, used to execute multidimensional queries, is created on executing the example. The cursor, containing the result, is created after the query execution. The results are displayed in the development environment console.
Executing the example requires that the repository contains an ADOMD catalog with the ADOMDTest identifier. This example is an entry point of the .NET assembly.
Imports Prognoz.Platform.Interop.AdoMd;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Catalog: IAdoMdCatalogInstance;
Connection: IAdoMdConnection;
sMDX: String;
Command: IDalCommand;
ResultCursor: IDalCursor;
CFields: IDalCursorFields;
CField: IDalCursorField;
i: Integer;
Begin
MB := Params.Metabase;
Catalog := MB.ItemById["ADOMDTest"].Open(Null) As IAdoMdCatalogInstance;
Connection := Catalog.Connection;
sMDX := "SELECT ...";
Command := Connection.Command(sMDX);
//MDX query execution
Command.Execute();
//Get execution results
ResultCursor := Command.CreateCursor();
CFields := ResultCursor.Fields;
While Not ResultCursor.Eof() Do
For i := 0 To CFields.Count - 1 Do
CField := CFields.Item[i];
System.Diagnostics.Debug.WriteLine(CField.Name + " | " + CField.Value);
End For;
ResultCursor.Next();
End While;
End Sub;
The command, used to execute multidimensional queries, is created on executing the example. The cursor, containing the result, is created after the query execution. The results are displayed in the development environment console.
See also: