Can't get mobileGetContactData(contactID) to work

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
olieolson
Posts: 3
Joined: Sat Jun 09, 2012 12:47 am

Can't get mobileGetContactData(contactID) to work

Post by olieolson »

Always returns empty. Anyone having any luck with this?

mobilefind, mobilepick and mobileAdd all work for me. I want to be able to query the current record and update if needed.

Here's the test script I'm using:


on mouseUp
mobileShowContact field "contactIDFld"
put mobileGetContactData( field "contactIDFld") into resultThang
if resultThang is empty then
put "Whoops" into field "searchresults"
else
put resultThang into field "searchresults"
end if

end mouseUp


Thanks in advance!!

Olie
sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Can't get mobileGetContactData(contactID) to work

Post by sturgis »

From the dictionary entry:
Value:
An array of key/data entries for the specified user ID

If no contact could be found, then no array is returned.
Use a test like: "if the result is an array" to determine if contact information was returned. "if the result is empty" will always be empty, even if data is returned in an array.
Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Can't get mobileGetContactData(contactID) to work

Post by Dixie »

Olie..

try something like this...

Code: Select all

on mouseUp
   put mobileGetContactData(1) into theData[contact]
   put theData[contact]["firstname"] & cr after red
   put theData[contact]["lastname"] & cr after red
   put red into fld 1
end mouseUp
be well,

Dixie
olieolson
Posts: 3
Joined: Sat Jun 09, 2012 12:47 am

Re: Can't get mobileGetContactData(contactID) to work

Post by olieolson »

Dixie,

Thanks! That works like a charm. I'm a little emabaressed that I didn't see that myself...

You're awesome!

Donald
Post Reply