Slighthaze = [color blue]NULL[/color]
[img http://www.sweetpotatosoftware.com/ttimages/mappoint.gif]
[color red]You will need at least the trial version of Mappoint 2001 or 2002 installed on your system in order to run this example.[/color]
This shows a simple example for automating Microsoft's Mappoint to show a datamap of sales totals by state. The different colors represent sales within a particular range(see the legend to the left of the map). These totals could have just as easily been broken out by ZIP code, county, city, or whatever. The area shown could be as small as a part of town for instance showing one salesperson's territority and what the break outs were for it. As you can see, this is kind of like an MS Chart on steroids. This doesn't begin to scratch the surface of automating Mappoint from VFP, but it may give you a few new data reporting ideas.
Though the code looks like a lot, most of it is fluff...I wanted to show most of the Mappoint Constants and I set up a textfile to hold the sales totals and act as my data.
*CUT-N-PASTE the code below into a prg file and run it from within VFP
WAIT WINDOW "Automating Mappoint... ONE MOMENT PLEASE" NOWAIT
lcMessage = "WORKING: 25% " + Replicate("|",12)
set message TO lcMessage
**************************************************************
*!* Real work begins here
**************************************************************
PUBLIC oMap, oDataSet, oDataMap
LOCAL sTempDirectory, sDataSource
sDataSource = lcFile
oMap = CREATEOBJECT('mappoint.application')
lcMessage = "WORKING: 40% " + Replicate("|",20)
set message TO lcMessage
oDataSet = oMap.ActiveMap.DataSets.ImportData(sDataSource, , geoCountryUnitedStates, geoDelimiterTab)
lcMessage = "WORKING: 60% " + Replicate("|",30)
set message TO lcMessage
oField = oDataSet.Fields(2) &&Values in second field
oDataMap = oDataSet.DisplayDataMap(geoDataMapTypeShadedArea, oField, geoShowByZoomLevel, geoCombineByNone, ;
geoRangeTypeDiscreteEqualRanges, geoRangeOrderHighToLow, 15, 8)
lcMessage = "WORKING: 80% " + Replicate("|",40)
set message TO lcMessage
oDataMap.LegendTitle = "Sales Totals by State"
lcMessage = "WORKING: 100% " + Replicate("|",50)
set message TO lcMessage
WAIT CLEAR
set message to
oMap.Visible= .T.
Erase (lcFile)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.