Community of VE/MapPoint Users and Developers
This is a discussion on I have territories based on Counties. I have also.... within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have territories based on Counties. I have also imported sales by county. How can I get the sales to ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| The only way to manipulate territories is to import them; there is no link or other programmatic manipulation. So you have to do something like the following (this is untested as written and doesn't include variable declarations and error handling): <pre> arrFields(1, 1) = "StateCode": arrFields(1, 2) = geoFieldRegion1 arrFields(2, 1) = "CountyName": arrFields(2, 2) = geoFieldRegion2 arrFields(3, 1) = "TerritoryAssignment": arrFields(3, 2) = geoFieldData arrFields(4, 1) = "TerritorySales": arrFields(4, 2) = geoFieldData Set cn = New ADODB.Connection cn.ConnectionTimeout = 120 cn.CommandTimeout = 120 cn.Open "...insert database connection string..." Set objMap = objMapPoint.ActiveMap 'Clear the map. For Each objDataSet In objMap.DataSets If Not objDataSet.Name = "My Pushpins" Then objDataSet.Delete End If Next With objMap.DataSets gstrUDLLocation = "...location of UDL pointer to database..." ' vwMapSalesTerritories is a SQL Server view that contains fields ' that defines the territories. sConnection = gstrUDLLocation & "!vwMapSalesTerritories" Set objDS = .ImportTerritories(sConnection, , _ geoCountryUnitedStates, geoDelimiterTab, _ geoImportFirstRowNotHeadings) End With Set objDS = Nothing With objMap.DataSets ' vwMapSalesByTerritory is a SQL Server view that contains sales ' data by territory returning the arrFields array. sConnection = gstrUDLLocation & "!vwMapSalesByTerritory" Set objDS = .ImportData(sConnection, _ arrFields, _ geoCountryUnitedStates, _ geoDelimiterDefault) End With objDS.DisplayDataMap DataMapType:=geoDataMapTypeShadedArea, _ DataField:=objDS.Fields("TerritoryAssignment"), _ ShowDataBy:=geoShowByRegion2, _ CombineDataBy:=geoCombineByNone, _ DataRangeType:=geoRangeTypeUniqueValues, _ DataRangeOrder:=geoRangeOrderDefault, ColorScheme:=3 objDS.ZoomTo objDS.DataMap.LegendTitle = txtMapTitle.Text objMap.MapStyle = geoMapStyleData </pre> After this is executed, the territories are drawn and the sales data is shown on a tooltip that is displayed when you hover over a county. - Walt Cygan |
![]() |
| Tags |
| based, counties, territories |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mappoint 2004 and territories based on Canadian postal codes | Penka | MapPoint 2006/2009 Discussion | 2 | 05-04-2006 10:16 AM |
| Mappoint 2004 and territories based on Canadian postal codes | Penka | MapPoint 2006/2009 Discussion | 5 | 02-28-2006 03:21 PM |
| noob help with counties | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-24-2005 08:25 AM |
| TEXT WITHIN COUNTIES | Anonymous | MapPoint 2006/2009 Discussion | 0 | 07-09-2004 01:54 PM |
| I am looking to create territories based on time z.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 09-12-2001 01:03 PM |