Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 2 of 2

I have territories based on Counties. I have also....

This is a discussion on I have territories based on Counties. I have also.... within the MapPoint Desktop 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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    I have territories based on Counties. I have also imported sales by county. How can I get the sales to display by territory and to react dynamically to changes in county territory assignments?

  2. #2
    Walt Cygan is offline Senior Member Green Belt
    Join Date
    Aug 2002
    Posts
    124

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mappoint 2004 and territories based on Canadian postal codes
    By Penka in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 05-04-2006, 09:16 AM
  2. Mappoint 2004 and territories based on Canadian postal codes
    By Penka in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 02-28-2006, 02:21 PM
  3. noob help with counties
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-24-2005, 07:25 AM
  4. TEXT WITHIN COUNTIES
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-09-2004, 12:54 PM
  5. I am looking to create territories based on time z....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-12-2001, 12:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83