CreateSliceMapDataAdapter(AdapterType: PrxMapAdapter; Slice: IPrxSlice): IPrxMapDataAdapter;
CreateSliceMapDataAdapter(AdapterType: Prognoz.Platform.Interop.Report.PrxMapAdapter; Slice: Prognoz.Platform.Interop.Report.IPrxSlice): Prognoz.Platform.Interop.Report.IPrxMapDataAdapter;
AdapterType. Adapter type for displaying source data on a map.
Slice. A slice, which data must be displayed on a map.
The CreateSliceMapDataAdapter method creates a data adapter for a map allowing to display data from the slice on it.
Executing the example requires a regular report with the REGULAR_REPORT identifier, the report's active page contains a map with the Regions layer. A cube with the CUBE_SEP identifier is added to the list of report data sources, the Map slice is created based on the cube. The cube contains the Territories dimension.
Add links to the Dimensions, Map, Metabase, Report, Tab system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Tab: ITabSheet;
Map: IMap;
BarVisual: IMapBarVisual;
PrxDA: IPrxMapDataAdapter;
Slice: IPrxSlice;
DataAdapterM: IPrxDataAdapterManager;
Begin
Mb := MetabaseClass.Active;
MObj := Mb.ItemById("REGULAR_REPORT").Edit;
Report := MObj As IPrxReport;
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Map := Tab.Objects.Item(0).Extension As IMap;
BarVisual := Map.Layers.FindByName("Regions").Visuals.AddBarVisual;
Slice := Report.DataSources.FindById("CUBE_SEP").Slices.FindByName("Map");
DataAdapterM := New PrxDataAdapterManager.Create;
PrxDA := DataAdapterM.CreateSliceMapDataAdapter(PrxMapAdapter.Static, Slice);
PrxDA.Dimension := Slice.Dimensions.FindByName("Territories").Dimension.Dimension;
PrxDa.Index := PrxDA.Dimension.Indexes.PrimaryIndex;
PrxDA.Attribute := "ID";
BarVisual.DataAdapter := PrxDA As IMapDataAdapter;
MObj.Save;
End Sub UserProc;
After executing the example a new bar indicator displaying data on the specified slice is created for a map.
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.Map;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Tab: ITabSheet;
Map: IMap;
BarVisual: IMapBarVisual;
PrxDA: IPrxMapDataAdapter;
DataAdapterM: PrxDataAdapterManager = New PrxDataAdapterManagerClass();
Slice: IPrxSlice;
Begin
Mb := Params.Metabase;
MObj := Mb.ItemById["REGULAR_REPORT"].Edit();
Report := MObj As IPrxReport;
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Map := Tab.Objects.Item[0].Extension As IMap;
BarVisual := Map.Layers.FindByName["Regions"].Visuals.AddBarVisual();
Slice := Report.DataSources.FindById("CUBE_SEP").Slices.FindByName("Map");
PrxDA := DataAdapterM.CreateSliceMapDataAdapter(PrxMapAdapter.pmaStatic, Slice);
PrxDA.Dimension := Slice.Dimensions.FindByName("Territories").Dimension.Dimension;
PrxDa.Index := PrxDA.Dimension.Indexes.PrimaryIndex;
PrxDA.Attribute := "ID";
BarVisual.DataAdapter := PrxDA As IMapDataAdapter;
MObj.Save();
End Sub;
See also: