Hi, I guess you are missing one dimension of the phone numbers array. The code below works fine for me. Hope it helps.
Code: Select all
on mouseUp
mobilePickContact -- let user choose a contact
put the result into tID -- LC returns an ID number
if tID is empty then
exit to top
end if
put mobileGetContactData(tID) into tData -- store the array in a variable
put the keys of tData into aux
repeat with x = 1 to the number of lines of aux
switch the line x of aux
case "phone"
addPhones tData
break
case "address"
addAddress tData
break
case "email"
addemail tData
break
end switch
end mouseUp
Code: Select all
command addPhones tData
put "mobile,iphone,main,home,work,other" into tPossNumberTypes
repeat with x = 1 to 6
put item x of tPossNumberTypes into tType
if not(tData["phone"][tType][1] is empty) then
put field "ContactData" of card "ListCard" & tType & " number" & CR & "> " & tData["phone"][tType][1] & CR into field "ContactData" of card "ListCard"
end if
end repeat
end addPhones
note: there maybe some errors because I took the code from a larger piece but I guess is good enough to get the idea.
Best