Page 1 of 1

Contact service query specific ID

Posted: Tue Nov 19, 2013 7:53 am
by Ram

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.


Contact service query specific ID

Posted: Tue Nov 19, 2013 8:33 am
by Ram

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...


Contact service query specific ID

Posted: Tue Nov 19, 2013 9:05 am
by Maryna Brodina

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


Contact service query specific ID

Posted: Tue Nov 19, 2013 9:20 am
by Ram

you are AWESOME!!!

Image