adding "map" address button

Support for our integrated Contact Manager, Calendar, and Project Tracker.
Posts: 26
Joined: Mon Dec 08, 2008 12:52 pm
PostPosted: Mon Jul 25, 2011 10:40 am
Good Morning,

I am using SeedCode Complete and would like to add the "map" address button on the Contacts layout to another layout. I have tried simply copying & pasting it, but this doesn't work. I want it to work in exactly the same way it does on the Contacts layout (new window with google maps in satellite view).

Is there an easy way to do this?

Thanks,

Shelley
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Tue Jul 26, 2011 7:09 am
Hi Shelley,

The button has a parameter attached to it which determines the address, so from Contacts it's:

List (
Contacts::AddressStreet1 ;
Contacts::AddressCity ;
Contacts::AddressState ;
Contacts::AddressPostCode
)

Depending on where you're pasting the button, you'll need to adjust the parameter with the correct address values.

Let me know if that helps,
Jason
Posts: 26
Joined: Mon Dec 08, 2008 12:52 pm
PostPosted: Wed Jul 27, 2011 8:16 am
Hi Jason,

Let me just start by saying that I know nothing about scripts. That being said this is what I have done:

I have created a new table which I call Properties. In this layout I have copied the Map address button from Contacts and then changed the parameter to reflect Properties information. This did not work. I then looked at the field in Contacts and saw that the field was something called _c_CommonOne. I did not have this field in my Properties table, so I created it just as the one in Contacts. I then used this field in my Properties layout and created a button with it and used the script "Address - Map" (which is for Contacts) and added the parameter with my Properties info and still nothing. Do I need to write a script specifically for Properties?

Thanks for your time!

Shelley
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Wed Jul 27, 2011 8:28 am
Hi Shelley,

You shouldn't need to do a new script, only change the parameter. What are the address field named for Properties? You should just be able to substitute these into the parameter, and then it should work, something like:

List (
Properties::AddressStreet1 ;
Properties::AddressCity ;
Properties::AddressState ;
Properties::AddressPostCode
)

To change the parameter, double click on the button in layout mode and you should see this:

1.png
1.png (76.44 KiB) Viewed 5778 times


Then click on the Specify button to see this:

2.png
2.png (67.93 KiB) Viewed 5778 times


Then hit Edit... to bring up the following, where you can adjust the parameter to reference your Property Addresses rather than the Contacts ones:

3.png
3.png (75.6 KiB) Viewed 5778 times



That should do it, but let me know, we'll make a scripter out of you yet! :wink:

-Jason
Posts: 26
Joined: Mon Dec 08, 2008 12:52 pm
PostPosted: Wed Jul 27, 2011 12:43 pm
Hi Jason,

I just created a new button from scratch on my Properties layout, told it to "Perform Script", then specified the "Address - Map" script then added the parameter:

List (
Properties::Address ;
Properties::City ;
Properties::State ;
Properties::Zip
)

It still doesn't work, I must be missing something, I just don't know what. Do I need to add a field to my Properties layout like the _c_CommonOne and use that as a button as in Contacts?

Thanks again,

Shelley
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Wed Jul 27, 2011 1:05 pm
Hi Shelley,

Sorry!!! I forgot you were on the old version of Complete :oops:

Unfortunately, changing this in the old Complete is much more difficult. You'll need to duplicate the whole script, then in the OpenURL script step, substitute every reference to ContactAddrMailTo to the corresponding value in Properties.

To be consistent you can add a field for Country in your Properties table, but you can leave it empty, and the script will assume USA.

I did a quick screencast to get you started in the right direction:

http://screencast.com/t/v9HhSAuWJa

Let me know if that helps,
Jason
Posts: 26
Joined: Mon Dec 08, 2008 12:52 pm
PostPosted: Wed Jul 27, 2011 2:46 pm
Hi Jason,

I could have mentioned that I was using the old version, no worries!

I think I did all that you explained in the screencast (very cool by the way) but I am still having no luck. I copied the script below. Do you see any errors? I am in no hurry on this, please take as much time as you need.

I really really appreciate the time you have devoted to this on my behalf.

Thanks again,

Shelley



Let ( [

USA =

(
IsEmpty ( Properties::Country )
and
(
IsEmpty ( ContactSettings::SettingsMapServiceCountry ) or
ContactSettings::SettingsMapServiceCountry= "US" or
ContactSettings::SettingsMapServiceCountry = "USA" or
ContactSettings::SettingsMapServiceCountry = "United States" or
ContactSettings::SettingsMapServiceCountry = "United States of America"
)
)

or

Properties::Country = "US" or
Properties::Country = "USA" or
Properties::Country = "United States" or
Properties::Country = "United States of America"

] ;

Case (

ContactSettings::SettingsMapService = "Mapquest" or USA ≠ 1;

Case (

// United States

USA = 1 ;

"http://www.mapquest.com/maps/map.adp?searchtype=address&address=" &
Substitute ( Trim( Properties::Address ) ; " " ; "+" ) & "&" &
"city=" & Substitute ( Trim( Properties::City ) ; " " ; "+" ) & "&" &
"state=" & Substitute ( Trim( Properties::State ) ; " " ; "+" ) & "&" &
"zipcode=" & Substitute ( Trim( Properties::Zip ) ; " " ; "+" )

;

// Other Countries


"http://www.mapquest.com/maps/map.adp?searchtype=address&country=" &
If ( IsEmpty ( Properties::Country ) ; ContactSettings::SettingsMapServiceCountry ; Properties::Country )
& "&address="

&

Substitute ( Trim( Properties::Address ) ; " " ; "+" ) & "&" &
"city=" & Substitute ( Trim( Properties::City ) ; " " ; "+" ) & "&" &
"state=" & Substitute ( Trim( Properties::State ) ; " " ; "+" ) & "&" &
"zipcode=" & Substitute ( Trim( Properties::Zip ) ; " " ; "+" )
) ;

// Google

"http://maps.google.com/maps?q=" &
Substitute (
Trim(
Properties::Address & " " &
Properties::City & " " &
Properties::State & " " &
Properties::Zip
)
; " " ; "+" )

) // End Case test for map service


) // End Let
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Wed Jul 27, 2011 2:53 pm
Hi Shelley,

It looks right if those are the correct field names for properties. I think you're very close, so if you'd like to send me your file I should be able to pull you across the line. :wink:

Please zip it up and send it to [email protected]. If it zips over 15mb, then you can use a service like sendbigfiles.com to get them "here." Please include the [Full Access] account name and password.

John and I both have Devcon next week, so I may not get to it until after then, but as I said, I think you're close, so we should be able to resolve this this week.

Cheers!

Return to SeedCode Calendar

Who is online

Users browsing this forum: No registered users and 3 guests

(855) SEEDCODE
[email protected]
Follow us: