Condition: IExpression;
Condition: Prognoz.Platform.Interop.ForeSystem.IExpression;
The Condition property returns the formula, by which data is filtered for dimension.
To determine whether filtering settings are used for dimension, use IPivotDimensionFilterSettings.UseCondition.
To set an expression as a character string, use IExpression.AsString.
If a formula contains parameter, the ":" character is placed before the parameter. For example, a formula looks as follows: AttributeId >= :Parameter, where:
AttributeId. Dictionary attribute identifier.
:ParametrId. Report parameter identifier.
Executing the example requires that the repository contains an express report with the EXPRESS_FILTER identifier. Cube is a data source. The first dimension has an attribute with the ORDER identifier.
Add links to the Dal, Express, Metabase and Pivot system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Pivot: IPivot;
Dim: IPivotDimension;
Filter: IPivotDimensionFilterSettings;
Param: IMetabaseObjectParam;
Begin
MB := MetabaseClass.Active;
Express := MB.ItemById("EXPRESS_FILTER").Edit As IEaxAnalyzer;
// Add parameter
Param := (Express As IMetabaseObject).Params.Add;
Param.DataType := DbDataType.Integer;
Param.Name := "ParamExp";
Param.Id := "ParamExp";
Param.DefaultValue := 2;
// Get display settings of report data table
Pivot := Express.Pivot;
// Get dimension
Dim := Pivot.Dimensions.Item(0);
// Get filtering settings for dimension
Filter := Dim.Settings.Filter;
// Set expression, by which filtering is executed
Filter.UseCondition := True;
Filter.Condition.AsString := "Order>:ParamExp";
// Save changes
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example a new parameter is created for report. An expression for data filtering with the use of this parameter is set for the first table dimension.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Pivot;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Pivot: IPivot;
Dim: IPivotDimension;
Filter: IPivotDimensionFilterSettings;
Param: IMetabaseObjectParam;
Begin
MB := Params.Metabase;
Express := MB.ItemById["EXPRESS_FILTER"].Edit() As IEaxAnalyzer;
// Add parameter
Param := (Express As IMetabaseObject).Params.Add();
Param.DataType := DbDataType.ddtInteger;
Param.Name := "ParamExp";
Param.Id := "ParamExp";
Param.DefaultValue := 2;
// Get display settings of report data table
Pivot := Express.Pivot;
// Get dimension
Dim := Pivot.Dimensions.Item[0];
// Get filtering settings for dimension
Filter := Dim.Settings.Filter;
// Set expression, by which filtering is executed
Filter.UseCondition := True;
Filter.Condition.AsString := "Order>:ParamExp";
// Save changes
(Express As IMetabaseObject).Save();
End Sub;
See also: