Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

Contact service query specific ID

Dear Appery,

using phonegap contacts, what is the correct way to retrieve a specific record (contact) based on its ID# say 5437?

Image

Many thanks in advance!
Best,
R.

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

Contact service query specific ID

some progress but no joy yet, here's what i did so far:

Image

and on the success event i have:

code
for (var i=0;i<data&#46;length;i++)
{

var phoneNumbers = data&#46;phoneNumbers;

for (var j=0;j<phoneNumbers&#46;length;j++)
{
var type = phoneNumbers[j]&#46;type;
var phone = phoneNumbers[j]&#46;value;
alert(type + ": " + phone);
}
/code

when fired i get the correct ID but then the app stuck on the spinner...

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Contact service query specific ID

Hello! You can't search using spesific id - it searches through all the fields. Just specify needed id in filter field and then on service success event add additional filter to exclude records which have different id:
codefor (var i=0; i<data&#46;length; i++) {
if (data&#46;id == '5437') {
var phoneNumbers = data&#46;phoneNumbers;
for (var j=0; j<phoneNumbers&#46;length; j++) {
var type = phoneNumbers[j]&#46;type;
var phone = phoneNumbers[j]&#46;value;
alert(type + ": " + phone);
}
break;
}
}/code

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

Contact service query specific ID

you are AWESOME!!!

Image

Return to “Issues”