IMDCalculationInstance.GetProcedureText

Fore Syntax

GetProcedureText(Args: IMDCalculationCalculateArgs; ProcName: String): String;

Fore.NET Syntax

GetProcedureText(

Args: Prognoz.Platform.Interop.Cubes.IMDCalculationCalculateArgs;

ProcName: String): String;

Parameters

Args. Parameters, according to which text of procedure of execution of multidimensional calculation on DB server is generated.

ProcName. Name of the procedure that is created on DB server when the generated code is executed.

Description

The GetProcedureText method generates text of procedure, which can be used to start multidimensional calculation on DB server.

Comments

If the ProcName parameter is specified in the method, the following string is included in the procedure text: CREATE PROCEDURE <ProcName> as. On executing the obtained code this string enables the user to create a procedure on DB server instead of starting multidimensional calculation.

If dependency of formulas on time is set in the multidimensional calculation, and the DateBegin and DateEnd parameters are specified in the Args argument, two parameters that are used to specify start and end dates of period are added to the CREATE PROCEDURE <ProcName> as string. The string looks as follows: CREATE PROCEDURE <ProcName>(ArgDateBegin in DATE, ArgDateEnd in DATE) as.

Fore Example

Executing the example requires a form, a button with the Button1 name and the Memo component with the Memo1 name. The repository contains a multidimensional calculation on DB server with the MDCalc_1 identifier. Dependency of formulas on time is set in multidimensional calculation settings.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        MB: IMetabase;
        MDInst: IMDCalculationInstance;
        CalcArg: IMDCalculationCalculateArgs;
        Text_Proc: String;
    Begin
        MB := MetabaseClass.Active;
        MDInst := MB.ItemById("MDCalc_1").Open(NullAs IMDCalculationInstance;
        CalcArg := MDInst.CreateCalculateArgs;
        CalcArg.CleanType := MDCalculateArgsCleanType.None;
        CalcArg.UpdateType := MDCalculateArgsUpdateType.All;
        CalcArg.DateBegin := DateTime.ComposeDay(200011);
        CalcArg.DateEnd := DateTime.ComposeDay(20101231);
        Text_Proc := MDInst.GetProcedureText(CalcArg, "CalculateProc");
        Memo1.Lines.Add(Text_Proc);
    End Sub Button1OnClick;

After executing the example pressing the button generates text of the procedure that can be used to start execution of multidimensional calculation on DB server. The obtained text is displayed in the Memo1 component. This text contains a string that is used to create a procedure on DB server.

Fore.NET Example

Executing the example requires a form, a button with the Button1 name on the form, the TextBox component with the TextBox1 name. The repository contains a multidimensional calculation on DB server with the MDCalc_1 identifier. Dependency of formulas on time is set in multidimensional calculation settings.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Metabase;

    Private Sub button1_Click( sender : System.Object; e : System.EventArgs );
    Var
        MB: IMetabase;
        MDInst: IMDCalculationInstance;
        CalcArg: IMDCalculationCalculateArgs;
        Text_Proc: System.Collections.Generic.List <String> = New System.Collections.Generic.List <String>();
    Begin
        MB := Self.Metabase;
        MDInst := MB.ItemById["MDCalc_1"].Open(NullAs IMDCalculationInstance;
        CalcArg := MDInst.CreateCalculateArgs();
        CalcArg.CleanType := MDCalculateArgsCleanType.cactNone;
        CalcArg.UpdateType := MDCalculateArgsUpdateType.cautAll;
        CalcArg.DateBegin := DateTime.Parse("1.1.2000");
        CalcArg.DateEnd := DateTime.Parse("1.1.2010");
        Text_Proc.Add(MDInst.GetProcedureText(CalcArg, "CalculateProc"));
        TextBox1.Lines := Text_Proc.ToArray();
    End Sub;

After executing the example pressing the button generates text of the procedure that can be used to start execution of multidimensional calculation on DB server. The obtained text is displayed in the TextBox1 component. This text contains a string that is used to create a procedure on DB server.

See also:

IMDCalculationInstance