Attribute: String;
The Attribute property determines attribute of the map layer.
Executing the example requires a regular report with the REGULAR_REPORT identifier, the report active page contains a map with the Regions layer. A cube containing the Territories dimension is added to the list of report data sources. Add links to the Metabase, Report, Tab, Map, Dimensions system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Tab: ITabSheet;
Map: IMap;
BarVisual: IMapBarVisual;
PrxDA: IPrxMapDataAdapter;
Slice: IPrxSlice;
MapDAdapt: IPrxMapDataAdapter;
i, j: Integer;
Begin
Mb := MetabaseClass.Active;
MObj := Mb.ItemById("REGULAR_REPORT").Edit;
Report := MObj As IPrxReport;
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Map := Tab.Objects.Item(1).Extension As IMap;
BarVisual := Map.Layers.FindByName("Regions").Visuals.AddBarVisual;
Slice := Report.DataSources.Item(0).Slices.Item(0);
PrxDA := Slice.CreateMapDataAdapter(PrxMapAdapter.Dynamic);
PrxDA.Dimension := Slice.Dimensions.FindByName("Territories").Dimension.Dimension;
PrxDa.Index := PrxDA.Dimension.Indexes.PrimaryIndex;
PrxDA.Attribute := "ID";
BarVisual.DataAdapter := PrxDA As IMapDynamicDataAdapter;
PrxDA.Expression.AsString := "AT[Id]+" + Char.Chr(34) + ")" + Char.Chr(34) + "+AT[Name]";
PrxDa.Expression2.AsString := "VALUE";
Map.Layers.FindByName("Regions").TerritoryInfoAdapter := PrxDa;
MObj.Save;
End Sub UserProc;
After executing the example a bar indicator is created for the Regions map layer, and the custom label format for names and identifiers is set in the map layer territory info.
See also: