IPrxDataAdapterManager.CreateRangeMapDataAdapter

Syntax

CreateRangeMapDataAdapter(AdapterType: PrxMapAdapter; Sheet: IPrxSheet): IPrxMapDataAdapter;

Parameters

AdapterType. Adapter type for displaying source data on the map.

Sheet. A page containing data ranges, which should be displayed on the map.

Description

The CreateRangeMapDataAdapter method creates a data adapter for a map allowing to display data from the specified data range.

Comments

Identifiers of regions and values for them must be specified in separate ranges.

Example

Executing the example requires a regular report with the REGULAR_REPORT identifier, the first sheet of the report contains a map with the Regions layer, the second sheet of the report contains a table with data by regions. Add links to the Metabase, Report, Tab, Map system assemblies in the unit.

Sub UserProc;
Var
    Mb: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    Tab: ITabSheet;
    Map: IMap;
    BarVisual: IMapBarVisual;
    PrxDA: IPrxMapDataAdapter;
    Range: IPrxRange;
    DataAdapterM: IPrxDataAdapterManager;
Begin
    Mb := MetabaseClass.Active;
    MObj := Mb.ItemById("REGULAR_REPORT").Edit;
    Report := MObj As IPrxReport;
    Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
    // Add a bar indicator to map
    Map := Tab.Objects.Item(0).Extension As IMap;
    BarVisual := Map.Layers.FindByName("Regions").Visuals.AddBarVisual;
    // Create a data adapter for map
    DataAdapterM := New PrxDataAdapterManager.Create;
    PrxDA := DataAdapterM.CreateRangeMapDataAdapter(PrxMapAdapter.Static, Report.ActiveSheet);
    // Determine sheet with data
    PrxDa.Sheet := Report.Sheets.Item(1);
    // Set cell range containing region identifiers
    PrxDA.IdRange := Tab.ParseRange("B35:B37");
    // Set cell range with displayed data on map
    PrxDa.DataRange := Tab.ParseRange("C35:C37");
    BarVisual.DataAdapter := PrxDA As IMapDataAdapter;
    MObj.Save;
End Sub UserProc;

After executing the example a new bar indicator displaying data on specified regions is created for a map.

See also:

IPrxDataAdapterManager