Page 1 of 1

mobileGetContactData: help to read the "address" data

Posted: Fri Mar 06, 2020 3:32 pm
by simon.schvartzman
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!

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

Posted: Fri Mar 06, 2020 3:39 pm
by Klaus
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

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

Posted: Fri Mar 06, 2020 4:28 pm
by Thierry
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

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

Posted: Fri Mar 06, 2020 5:09 pm
by simon.schvartzman
Klaus & Thierry many thanks for your contributions, both of them are very valuable and will help me a lot.

Regards!