For what it's worth... I've gotten this to work.
I ended up generating a stored procedure (maybe I'll optimize it later, but it's late now and I want to catch some ZZZ...) I you don't know what a stored procedure is or how to make one, then you should contact a database programmer to help you out on this one.
OK - The stored procedure reads from the user and role tables in the DNN database. Only the users in a specific role and portal are selected from the data. The user data is then used to drive a cursor to collect data from the profile table for each UserID and pop it all into a temporary table.
The data in the temporary table is then put into the Map_Points table, filling in what I think are the required fields. For each map point, the Description field is filled with the user's name, company, address and contact info.
Once I run this stored procedure, I then run the geolocator function and it creates all the latitude and longitude points.
Easy huh?
Have Fun,
Greg
Here's the code -
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE dbo.Update_MapUser_List
AS
DECLARE @UserID Int
DECLARE @FirstName VarChar(128)
DECLARE @LastName VarChar(128)
DECLARE @FarmName VarChar(255)
DECLARE @FarmPhone VarChar(32)
DECLARE @Address VarChar(255)
DECLARE @Street VarChar(255)
DECLARE @City VarChar(255)
DECLARE @State VarChar(255)
DECLARE @ZipCode VarChar(255)
DECLARE @WebSite VarChar(255)
DECLARE @Email VarChar(255)
DECLARE @myTable TABLE
(
UserID Int,
FirstName VarChar(128),
LastName VarChar(128),
FarmName VarChar(255),
FarmPhone VarChar(32),
Address VarChar(255),
WebSite VarChar(255),
Email VarChar(255)
)
declare myUsers cursor read_only
For
SELECT dbo.Users.UserID, dbo.Users.Email
FROM dbo.Users INNER JOIN
dbo.UserPortals ON dbo.Users.UserID = dbo.UserPortals.UserId INNER JOIN
dbo.UserRoles ON dbo.Users.UserID = dbo.UserRoles.UserID
WHERE (dbo.UserPortals.PortalId = 8) AND (dbo.UserRoles.RoleID = 16) -- member 11 is subscriber
OPEN myUsers
FETCH NEXT from myUsers into @UserID, @Email
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @FirstName=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'FirstName') AND
(dbo.UserProfile.UserID = @UserID)
SELECT @LastName=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'LastName') AND
(dbo.UserProfile.UserID = @UserID)
SELECT @FarmName=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Farm_Name') AND
(dbo.UserProfile.UserID = @UserID)
SELECT @FarmPhone=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Farm_Phone') AND
(dbo.UserProfile.UserID = @UserID)
SELECT @Website=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Website') AND
(dbo.UserProfile.UserID = @UserID)
SELECT @Street=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Street') AND
(dbo.UserProfile.UserID = @UserID)
SELECT @City=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'City') AND
(dbo.UserProfile.UserID = @UserID)
SELECT @State=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Region') AND
(dbo.UserProfile.UserID = @UserID)
SELECT @ZipCode=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'PostalCode') AND
(dbo.UserProfile.UserID = @UserID)
INSERT INTO @myTable (
UserID,
FirstName,
LastName,
FarmName,
FarmPhone,
Address,
WebSite,
Email)
VALUES (
@UserID,
@FirstName,
@LastName,
@FarmName,
@FarmPhone,
@Street + ', ' + @City + ', ' + @State + ' United States',
@WebSite,
@Email)
FETCH NEXT from myUsers into @UserID, @Email
END
CLOSE myUsers
DEALLOCATE myUsers
DELETE FROM dbo.Map_Points
INSERT INTO dbo.Map_Points(
SourceID,
GUID,
Address,
IconIndex,
Description,
SequenceNumber,
SequenceInfo,
ZoomShow,
ZoomHide,
SummaryCount)
SELECT
1,
UserID,
Address,
0,
FarmName+'<br/>'+FirstName+' '+LastName+'<br/>'+FarmPhone,
UserID,
0,
0,0,0
FROM @myTable
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO