FilterTransformations: IEaxDataAreaTransformations;
FilterTransformations: Prognoz.Platfrorm.Interop.Express.IEaxDataAreaTransformations;
The FilterTransformations property returns collection of data transformation formulas set on filtering.
Formula that will be determined in the expression of transformation formula should return boolean value. To enable filtering by the formula, it is required to set Pivot property.Filter property.Enable and Pivot property.Filter property.UseTransformationFilter properties to True. If the specified formula returns True for the cell, the cell becomes a part of the list of filtered ones and should be hidden, if it returns False - the cell stays visible. Which cells will be hidden depends on the settings specified in other properties of the IPivotFilter interface.
Executing the example requires a regular report with the REPORT identifier. An analytical data area is created in the report.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
DataArea: IEaxDataArea;
DataAreaSlice: IEaxDataAreaSlice;
DimSS: IDimSelectionSet;
Transforms: IEaxDataAreaTransformations;
Transform: IEaxDataAreaTransformation;
Filter: IPivotFilter;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("REPORT").Edit As IPrxReport;
DataArea := Report.DataArea As IEaxDataArea;
DataAreaSlice := DataArea.Slices.Item(0);
//Source dimension
DimSS := DataAreaSlice.Selection;
//Get transformation formula for filtering
Transforms := DataAreaSlice.FilterTransformations;
If Transforms.Count > 0 Then
Transform := Transforms.Item(0);
Else
Transform := Transforms.Add(DimSS, Null, -1);
End If;
//Determine formula: filter elements with values greater than 1000
Transform.Enabled := True;
Transform.Expression.AsString := "{X[t]} > 1000";
//Enable the use of filtering by formula
Filter := (DataAreaSlice As IEaxDataAreaPivotSlice).Pivot.Filter;
Filter.Enabled := True;
Filter.Elements := PivotFilterElements.Rows;
Filter.UseTransformationFilter := True;
//Refresh to display only filtered data
DataAreaSlice.Views.Item(0).Refresh;
//Saving
Report.MetabaseObject.Save;
End Sub UserProc;
Executing the example enables data filtering by the following formula in the analytical area: the strings where value of all cells is greater than 1000 are hidden.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Pivot;
Imports Prognoz.Platform.Interop.Report;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Report: IPrxReport;
DataArea: IEaxDataArea;
DataAreaSlice: IEaxDataAreaSlice;
DimSS: IDimSelectionSet;
Transforms: IEaxDataAreaTransformations;
Transform: IEaxDataAreaTransformation;
Filter: IPivotFilter;
Begin
MB := Params.Metabase;
Report := MB.ItemById["REPORT"].Edit() As IPrxReport;
DataArea := Report.DataArea As IEaxDataArea;
DataAreaSlice := DataArea.Slices.Item[0];
//Source dimension
DimSS := DataAreaSlice.Selection;
//Get transformation formula for filtering
Transforms := DataAreaSlice.FilterTransformations;
If Transforms.Count > 0 Then
Transform := Transforms.Item[0];
Else
Transform := Transforms.Add(DimSS, Null, uinteger.maxValue);
End If;
//Determine formula: filter elements with values greater than 1000
Transform.Enabled := True;
Transform.Expression.AsString := "{X[t]} > 1000";
//Enable the use of filtering by formula
Filter := (DataAreaSlice As IEaxDataAreaPivotSlice).Pivot.Filter;
Filter.Enabled := True;
Filter.Elements := PivotFilterElements.pfeRows;
Filter.UseTransformationFilter := True;
//Refresh to display only filtered data
DataAreaSlice.Views.Item[0].Refresh();
//Saving
Report.MetabaseObject.Save();
End Sub;
See also: