mobileGetContactData: help to read the "address" data

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
simon.schvartzman
Posts: 665
Joined: Tue Jul 29, 2014 12:52 am

mobileGetContactData: help to read the "address" data

Post by simon.schvartzman » Fri Mar 06, 2020 3:32 pm

Hi dear helpers, using mobileGetContactData I have been able to read all fields of a contact except the address contents.

It seems my knowledge about arrays is quite weak and I can't figure out how to put to work the dictionary entry on the subject:
Address - Addresses of the contact are stored as sub arrays under the key address. There are three categories of address:

"home" - The home address.
"work" - The work address.
"other" - The other address.
Address Subkey - Each address category is an integer indexed array, starting at one under the key address. This allows any number of a addresses to be stored against a particular category:

"street" - The address street.
"city" - The address city.
"state" - The address state.
"zip" - The address ZIP code.
"country" - The address country.
"countrycode" - The address country code (iOS only).
Can some one enlighten me please?

Many thanks in advance!
Simon
________________________________________
To ";" or not to ";" that is the question

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: mobileGetContactData: help to read the "address" data

Post by Klaus » Fri Mar 06, 2020 3:39 pm

Hi Simon,

sounds like this is the way to go:

Code: Select all

...
## tData is the array with the contacts
put tData["home"][1]["street"] into street_of_first_home_address
## etc. you get the picture
...
So -> the number of lines of the keys of tData["home"]
should give you the number of addresses saved as "home".

I do not own any cellphone or tablet, so this is out of my head. :-)


Best

Klaus

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: mobileGetContactData: help to read the "address" data

Post by Thierry » Fri Mar 06, 2020 4:28 pm

simon.schvartzman wrote:
Can some one enlighten me please?
Hi Simon,

I don't use mobileGetContact,
but what I would do is dump the resulting array in a field to visualise it.

You can use this code to do that:

https://forums.livecode.com/viewtopic.p ... 01#p175195


HTH,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

simon.schvartzman
Posts: 665
Joined: Tue Jul 29, 2014 12:52 am

Re: mobileGetContactData: help to read the "address" data

Post by simon.schvartzman » Fri Mar 06, 2020 5:09 pm

Klaus & Thierry many thanks for your contributions, both of them are very valuable and will help me a lot.

Regards!
Simon
________________________________________
To ";" or not to ";" that is the question

Post Reply