ShowDataAdapterDialog

Purpose

Opens a standard dialog box that is used to set up parameters of data adapter for different elements of a regular report map.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify an array of the Variant type in this property, the elements of this array contain the following values:

Value type Description
Element 1: IPrxReport The regular report, on a page of which a map is created.
Element 2: IPrxMap The map, which is set up.
Element 3: IMapLayer The map layer, which is set up.
Element 4: IPrxMapDataAdapter The data adapter, which parameters need must be changed. If the element is specified, values of elements 5 and 6 are set automatically.
If the Null value is passed, the dialog box is used to set up a new data adapter. The type of the adapter to be created must be also defined in the element 5 of the array.
Element 5: PrxMapAdapter Data adapter type.
Optional element. It is specified if the Null value is passed in the element 4.
Element 6: PrxAdapterDataType Type of data placement for adapter.
Optional element. If the existing adapter is edited (Element 4), and type of data placement is set (Element 6), it is impossible to select another type in the dialog box.

Application Features

The command is used only for regular reports. Executing the command shows the data adapter described by the IPrxMapDataAdapter, interface if the OK button is clicked in the dialog box, and empty value if the Cancel button is clicked.

NOTE. On closing the dialog box by clicking the OK button a new instance of data adapter is always returned. Therefore it is necessary to reassign the data adapter to the object, for which it was set up for the changes to be applied.

Fore Example

Executing the example requires a form with the Button1 button, the ReportBox component and the UiReport component named UiReport1, which is used as a data source for the ReportBox component. A map is positioned on active sheet of the regular report linked to UiReport1 component. A map indicator is created for the Regions layer.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
   Report: IPrxReport;
    PrxMap: IPrxMap;
    Map: IMap;
    Layer: IMapLayer;
    VisualColor: IMapVisualColorProperty;
    Da: IPrxMapDataAdapter;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Data: Array;
    Result: Variant;
Begin
    Report := UiReport1.Report;
    PrxMap := (Report.ActiveSheet As IPrxTable).TabSheet.Objects.Item(0).Extension As IPrxMap;
    Map := PrxMap As IMap;
    //Map layer
    Layer := Map.Layers.FindByName("Regions");
    //Parameters of map indicator color fill
    VisualColor := (Layer.Visuals.Item(0As IMapAreaVisual).Color;
    //Adapter for map indicator color fill
    Da := VisualColor.DataAdapter As IPrxMapDataAdapter;
    Target := WinApplication.Instance.GetPluginTarget("Report");
    Context := Target.CreateExecutionContext;
    Data := New Variant[4];
    Data[0] := Report;
    Data[1] := Map;
    Data[2] := Layer;
    Data[3] := Da;
    Context.Data := Data;
    Result := Target.Execute("ShowDataAdapterDialog", Context);
    If Result <> Null Then
        Da := Result;
        VisualColor.DataAdapter := Da;
    End If;
End Sub Button1OnClick;

Clicking the button opens a standard dialog box that is used to set up data adapter. The adapter that is used to bind data to map indicator color fill is set up in the dialog box. If the OK button is clicked in the dialog box, the adapter is updated in color fill options.

Fore.NET Example

Executing the example requires a form, the Button1 button on the form, the ReportBoxNet component and the UiReportNet component named UiReportNet1, which is used as a data source for the ReportBoxNet component. A map is positioned on active sheet of the regular report linked to UiReport1 component. A map indicator is created for the Regions layer.

Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Ui;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    Report: IPrxReport;
    PrxMap: IPrxMap;
    Map: IMap;
    Layer: IMapLayer;
    VisualColor: IMapVisualColorProperty;
    Da: IPrxMapDataAdapter;
    WinApp: WinApplication = New WinApplicationClass_2();
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Data: Array;
    Result: Object;
Begin
    Report := UiReportNet1.ReportUi.Report;
    PrxMap := (Report.ActiveSheet As IPrxTable).TabSheet.Objects.Item[0].Extension As IPrxMap;
    Map := PrxMap As IMap;
    //Map layer
    Layer := Map.Layers.FindByName["Regions"];
    //Map indicator parameters
    VisualColor := (Layer.Visuals.Item[0] As IMapAreaVisual).Color;
    //Settings of adapter for map indicator color fill
    Da := VisualColor.DataAdapter As IPrxMapDataAdapter;
    Target := WinApp.GetPluginTarget("Report");
    Context := Target.CreateExecutionContext();
    Data := New Object[4];
    Data[0] := Report;
    Data[1] := Map;
    Data[2] := Layer;
    Data[3] := Da;
    Context.Data := Data;
    Result := Target.Execute("ShowDataAdapterDialog", Context, Null);
    If Result <> Null Then
        Da := Result As IPrxMapDataAdapter;
        VisualColor.DataAdapter := Da;
    End If;
End Sub;

Clicking the button opens a standard dialog box that is used to set up data adapter. The adapter that is used to bind data to map indicator color fill is set up in the dialog box. If the OK button is clicked in the dialog box, the adapter is updated in color fill options.

See also:

IUiCommandTarget.Execute