mapenthuse
02-08-2008, 03:25 PM
I read code in a .net book about MP that told you how to loop through a circle of given radius around a given center and process the pushpins within (e.g. calculate directions).
My project, however, needs to process pushpins within given zip codes - no circles involved. How would I compose such code?
I'm planning on writing the directions to a word file.
Thanks much,
Gary
Wilfried
02-09-2008, 02:32 AM
Hi,
A pushpin has a Location property and this has a StreetAddress property with a PostalCode property. Is that what you wants ?
mapenthuse
02-11-2008, 08:22 AM
Are you telling me I should loop through all my push pins and test in an if statement for those whose postal property = the zip code I'm interested in?
How do you loop through all push pins?
Gary
Wilfried
02-15-2008, 08:21 AM
Hi,
Yes that's how to do it. Here is example in C#:
object o = 1;
Recordset rs = MP.ActiveMap.DataSets.get_Item(ref o).QueryAllRecords();
while (!rs.EOF) {
if (rs.Pushpin.Location.StreetAddress != null)
; // etc..
rs.MoveNext();
}
mapenthuse
02-15-2008, 08:59 AM
That code tests if there's a street address, I wanted to test of the push pins zip code equaled the one I'm interested in.
WE're actually doing it in VBA.
Thanks, though - it still is helpful.
gary
Wilfried
02-19-2008, 07:40 AM
Hi,
Yes but you have to check if Streetaddress property is not null. the Postal code property is one of the StreetAddress.
lfdmike
02-19-2008, 08:52 AM
Gary
Wilfried gave you a good start to your goal, you just need to fill in the whatever functionality you need to do with it. I expanded on the provided code for a sample, which will need to be syntaxed for whatever language you are working with
Recordset rs = MP.ActiveMap.DataSets.get_Item(ref o).QueryAllRecords();
while (!rs.EOF) {
if (rs.Pushpin.Location.StreetAddress != null)
then
retrieve postal code information from StreetAddress
if zipAddress = zipWanted
then
place pushpin data into matching set
else
place pushpin data into foreign set (if desired)
end if
else
place pushpin data into unkown set (if desired)
end if
rs.MoveNext()
}