IPrxMap.AdviseAdapter

Syntax

AdviseAdapter(Value: IPrxMapDataAdapter);

Parameters

Value. Map data source.

Description

The AdviseAdapter property informs map data adapter about changing data in the source. Adapter data is updated when the sheet of the regular report is calculated.

Fore Example

Executing the example requires a regular report with the REGULAR_REPORT identifier with a map (*.tbs) with source data on its sheet. Add links to the Metabase, Report, Tab, Map, Dimensions system assemblies in the unit.

Sub UserProc;
Var
    Metabase: IMetabase;
    Report: IPrxReport;
    Tab: ITabSheet;
    PrxMap: IPrxMap;
    Map: IMap;
    DtSources: IPrxDataSources;
    Slices: IPrxSlices;
    Slice: IPrxSlice;
    DimInst: IDimInstance;
    MapDAdapt: IPrxMapDataAdapter;
    Visual: IMapVisual;
Begin
    Metabase := MetabaseClass.Active;
    Report := Metabase.ItemById(
"REGULAR_REPORT").Edit As IPrxReport;
    Tab := (Report.ActiveSheet 
As IPrxTable).TabSheet;
    PrxMap := Tab.Objects.Item(
0).Extension As IPrxMap;
    Map := PrxMap 
As IMap;
    DtSources := Report.DataSources;
    Slices := DtSources.Item(
0).Slices;
    Slice := Slices.Item(
0);
    MapDAdapt := Slice.CreateMapDataAdapter(PrxMapAdapter.Static);
    DimInst := Slice.Dimensions.Item(
0).Dimension;
    MapDAdapt.Dimension := DimInst.Dimension;
    MapDAdapt.Index := DimInst.Indexes.Item(
0).Index;
    Visual := Map.Layers.Item(
0).Visuals.AddAreaVisual As IMapVisual;
    Visual.AttributeName := 
"Id";
    Visual.DataAdapter := MapDAdapt;
    Visual.Name := 
"Map indicator";
    PrxMap.AdviseAdapter(MapDAdapt);

    Report.MetabaseObject.Save;
End Sub UserProc;

After executing the example a new map indicator is created for the regular report map. If the source contains changed data, it is updated in the map adapter when the sheet of the regular report is calculated.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

Public Shared Sub Main(Params: StartParams);
Var
    Metabase: IMetabase;
    Report: IPrxReport;
    Tab: ITabSheet;
    PrxMap: IPrxMap;
    Map: IMap;
    DtSources: IPrxDataSources;
    Slices: IPrxSlices;
    Slice: IPrxSlice;
    DimInst: IDimInstance;
    MapDAdapt: IPrxMapDataAdapter;
    Visual: IMapVisual;
Begin
    Metabase := Params.Metabase;
    Report := Metabase.ItemById["REGULAR_REPORT"].Edit() As IPrxReport;
    Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
    PrxMap := Tab.Objects.Item[0].Extension As IPrxMap;
    Map := PrxMap As IMap;
    DtSources := Report.DataSources;
    Slices := DtSources.Item[0].Slices;
    Slice := Slices.Item[0];
    MapDAdapt := Slice.CreateMapDataAdapter(PrxMapAdapter.pmaStatic);
    DimInst := Slice.Dimensions.Item[0].Dimension;
    MapDAdapt.Dimension := DimInst.Dimension;
    MapDAdapt.Index := DimInst.Indexes.Item[0].Index;
    Visual := Map.Layers.Item[0].Visuals.AddAreaVisual() As IMapVisual;
    Visual.AttributeName := "Id";
    Visual.DataAdapter := MapDAdapt;
    Visual.Name := "Map indicator";
    PrxMap.AdviseAdapter(MapDAdapt);

    Report.MetabaseObject.Save();
End Sub;

See also:

IPrxMap