CreateSliceMapDataAdapter(AdapterType: PrxMapAdapter; Slice: IPrxSlice): 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.
See also: