GetProcedureText(Args: IMDCalculationCalculateArgs; ProcName: String): String;
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.
The GetProcedureText method generates text of procedure, which can be used to start multidimensional calculation on DB server.
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.
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(Null) As IMDCalculationInstance;
CalcArg := MDInst.CreateCalculateArgs;
CalcArg.CleanType := MDCalculateArgsCleanType.None;
CalcArg.UpdateType := MDCalculateArgsUpdateType.All;
CalcArg.DateBegin := DateTime.ComposeDay(2000, 1, 1);
CalcArg.DateEnd := DateTime.ComposeDay(2010, 12, 31);
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.
See also: