SQL: String;
The SQL property determines the SQL condition that is used to select elements, by which calculation is executed in the selected dimension.
It is relevant if the Type property is set to MDCalculationSliceFilterType.SQL.
Executing the example requires that the repository contains multidimensional calculation on DB server with the MDCalc_1 identifier. A data consumer is based on a calendar dimension with the CALEN identifier.
Sub Main;
Var
MB: IMetabase;
MDInst: IMDCalculationInstance;
Args: IMDCalculationCalculateArgs;
Filter: IMDCalculationSliceFilter;
Begin
MB := MetabaseClass.Active;
MDInst := MB.ItemById("MDCalc_1").Open(Null) As IMDCalculationInstance;
Args := MDInst.CreateCalculateArgs;
//Filter using SQL condition
Filter := Args.SliceFilter(MDInst.Calculation.Destination.Slices.FindById("CALEN"));
Filter.Type := MDCalculationSliceFilterType.SQL;
Filter.SQL := "%0:s >= TO_DATE('2005.01.01', 'YYYY.MM.DD') AND %0:s <= TO_DATE('2006.01.01', 'YYYY.MM.DD')";
MDInst.Calculate(Args);
End Sub Main;
After executing the example multidimensional calculation is executed on DB server. Calculation is executed by elements that contain formulas and that are located during 2005-2006.
See also: