Condition: IExpression;
The Condition property returns the expression, by which data is filtered by dimension.
The property is relevant if the UseCondition property is set to True. The created expression should return a logical value. It can contain various operators functions, attributes and parameters. If the expression is set, data by the dimension elements, foe which the expression returns True, will be hidden.
Executing the example requires that the repository contains an express report with the EXPRESS_FILTER identifier. A 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 a parameter
Param := (Express As IMetabaseObject).Params.Add;
Param.DataType := DbDataType.Integer;
Param.Name := "ParamExp";
Param.Id := "ParamExp";
Param.DefaultValue := 2;
// Get settings for displaying report data table
Pivot := Express.Pivot;
// Get dimension
Dim := Pivot.Dimensions.Item(0);
// Get filtering settings for dimension
Filter := Dim.Settings.Filter;
// Set the expression, by which filtering will be executed
Filter.UseCondition := True;
Filter.Condition.AsString := "Order>:ParamExp";
Filter.KeepParent := True;
// Save changes
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example a new parameter is created for the report. An expression for data filtering with the use of this parameter and the Order attribute is set for the first table dimension.
See also: