ShowFormulaEditor Command

Purpose

It displays the standard dialog box of the editor to set up a dimension element.

Parameters of Use

Value type Description
IEaxAnalyzer The express report, for which an expression must be created. Mandatory parameter.
IEaxDataAreaTransformation The object that is used to work with a data transformation formula. Mandatory parameter.
IDimInstance It contains properties and methods of access to dictionary data. It is required to search for a transformation element. Optional parameter.
IDimSelectionSet Selection used to build table.
Boolean The checkbox determines whether the filter settings panel is available. Available values:
  • True. Use filtering.
  • False. Do not use filtering.

Optional parameter.

IEaxDataArea Returns parameters of the analytical data area. Optional parameter.

Example

Executing the example requires a form, buttons named BUTTON1 and BUTTON2 on the form, the UiErAnalyzer component named UIERANALYZER1 that is a data source for the TabSheetBox1 component, the UiReport1 component that is a data source for the Tabsheetbox2 component. An express report with the FACTS identifier, which contains the calculated element, is connected to UiErAnalyzer1; a regular report with a dimension with the FACTS identifier, which contains the calculated element, is connected to Uireport1.

Add links to the Express, Pivot, Tab, Ui, Dimension and Report system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Express: IEaxAnalyzer;
    Transform: IEaxDataAreaTransformation;
    SelectSet: IDimSelectionSet;
    DimSelect: IDimSelection;
    Data: Array;
    Context: IUiCommandExecutionContext;
    Target: IUiCommandTarget;

Begin
    //Get express report
    Express := UiErAnalyzer1.ErAnalyzer;
    //Get selection, by which table is built
    SelectSet := Express.Pivot.Selection;
    //Get data slice
    Transform := Express.DataArea.Slices.Item(0).CalcTransformations.Item(0);
    
//Get dimension with calculated element
    DimSelect := SelectSet.FindById(
"FACTS");
    //Specify required array elements
    Data := New Variant[6];
    Data[
0] := Express;
    Data[
1] := Transform;
    Data[
2] := DimSelect.Dimension;
    Data[
3] := SelectSet;
    Data[
4] := True;
    Data[
5] := Express.DataArea;
    //Open obtained express report for view
    Target := WinApplication.Instance.GetPluginTarget("Express");
    Context := Target.CreateExecutionContext;
    Context.Data := Data;
    Target.Execute(
"ShowFormulaEditor", Context);
End Sub Button1OnClick;

Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
    
Var
    Report: IPrxReport;
    Slice: IEaxDataAreaTransformation;
    DimSelect: IDimSelection;
    SelectSet: IDimSelectionSet;
    Data: Array;
    Context: IUiCommandExecutionContext;
    Target: IUiCommandTarget;
    DataArea: IEaxDataArea;
    PivSlice: IEaxDataAreaPivotSlice;
    Pivot: IPivot;
Begin
    
//Get report
    Report := UiReport1.Report;
    
// Get analytical data area of regular report
    DataArea := Report.DataArea;
    
// Get base for building analytical area slice
    PivSlice := DataArea.Slices.Item(0As IEaxDataAreaPivotSlice;
    
//Get selection, by which table is built
    Pivot := PivSlice.Pivot;
    SelectSet := Pivot.Selection;
    
//Get data slice
    Slice := Report.DataArea.Slices.Item(0).CalcTransformations.Item(0);
    
//Get dimension with calculated element
    DimSelect := SelectSet.FindById("FACTS");
    
//Specify necessary array elements        
    Data := New Variant[6];
    Data[
0] := Pivot;
    Data[
1] := Slice;
    Data[
2] := DimSelect.Dimension;
    Data[
3] := SelectSet;
    Data[
4] := True;
    Data[
5] := Report.DataArea;
    
//Open report for view
    Target := WinApplication.Instance.GetPluginTarget("Express");
    Context := Target.CreateExecutionContext;
    Context.Data := Data;
    Target.Execute(
"ShowFormulaEditor", context);
End Sub Button2OnClick;

Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Pivot;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Ui;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Report;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    Express: IEaxAnalyzer;
    Grid: IEaxGrid;
    Slice: IEaxDataAreaSlice;
    Transformations: IEaxDataAreaTransformations;
    Transform: IEaxDataAreaTransformation;
    Pivot: IPivot;
    SelectSet: IDimSelectionSet;
    DimSelect: IDimSelection;
    Data: Array;
    Context: IUiCommandExecutionContext;
    Target: IUiCommandTarget;
    WinApp: WinApplication = New WinApplicationClass_2();
Begin
    Express := UiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
    Grid := Express.Grid;
    Pivot := Grid.Pivot;
    Slice := grid.Slice;
    SelectSet := Pivot.Selection;
    DimSelect := SelectSet.Item[1];
    Transformations := Slice.CalcTransformations;
    Transform := Transformations.Item[0];
    Data := New Object[6];
    Data[0] := Express;
    Data[1] := Transform;
    Data[2] := DimSelect.Dimension;
    Data[3] := SelectSet;
    Data[4] := False;
    Data[5] := Express.DataArea;
    Target := WinApp.GetPluginTarget("Express");
    Context := Target.CreateExecutionContext();
    Context.Data := Data;
    Target.Execute("ShowFormulaEditor", Context, Null);
End Sub;

Private Sub button2_Click(sender: System.Object; e: System.EventArgs);
Var
    Report: IPrxReport;
    Slice: IEaxDataAreaTransformation;
    DimSelect: IDimSelection;
    SelectSet: IDimSelectionSet;
    Data: Array;
    Context: IUiCommandExecutionContext;
    Target: IUiCommandTarget;
    DataArea: IEaxDataArea;
    PivSlice: IEaxDataAreaPivotSlice;
    Pivot: IPivot;
    WinApp: WinApplication = New  WinApplicationClass_2();
Begin
    
//Get report
    Report := UiReportNet1.Object.Edit() As IPrxReport;
    
// Get analytical data area of regular report
    DataArea := Report.DataArea;
    
// Get base for building analytical area slice
    PivSlice := DataArea.Slices.Item[0As IEaxDataAreaPivotSlice;
    
//Get selection, by which table is built
    Pivot := PivSlice.Pivot;
    SelectSet := Pivot.Selection;
    
//Get data slice
    Slice := Report.DataArea.Slices.Item[0].CalcTransformations.Item[0];
    
//Get dimension with calculated element
    DimSelect := SelectSet.FindById("OBJ837");
    
//Specify necessary array elements        
    Data := New Object[6];
    Data[
0] := Pivot;
    Data[
1] := Slice;
    Data[
2] := DimSelect.Dimension;
    Data[
3] := SelectSet;
    Data[
4] := True;
    Data[
5] := Report.DataArea;
    
//Open report for view
    Target := WinApp.GetPluginTarget("Express");
    Context := Target.CreateExecutionContext();
    Context.Data := Data;
    Target.Execute(
"ShowFormulaEditor",  Context,  Null);
End Sub;

After clicking the Button1 button a dialog box of expression editor for express report calculated element opens, which contains the element formula that can be edited:

After clicking the Button2 button a dialog box of expression editor for regular report calculated element opens, which contains the element formula that can be edited:

See also:

IUiCommandTarget.Execute