Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 47
Registered: ‎06-06-2011
My Device: bolt2
My Carrier: digicel jamaica

search multiple contact properties at one

Hi Am have a piece of code i got from this form that works perfectly to search i contact property at a tiime as seen here:

 for (var i = 0; i < search_query.length; i++)
     {
      hack = hack + "[" + search_query[i].toLowerCase() + search_query[i].toUpperCase() + "]";
     }

     var feFname = new blackberry.find.FilterExpression("firstName", "REGEX", hack + "[a-zA-Z_0-9_\\s]*");
	 
	 

     var result = blackberry.pim.Contact.find(feFname, "firstName", null, null, true);
	 

 

I however would like to make it so that as both firstname and last name fields are search at once. So I tried this but it does not work:

 

 for (var i = 0; i < search_query.length; i++)
     {
      hack = hack + "[" + search_query[i].toLowerCase() + search_query[i].toUpperCase() + "]";
     }

     var feFname = new blackberry.find.FilterExpression("firstName", "REGEX", hack + "[a-zA-Z_0-9_\\s]*");
	 var feLname = new blackberry.find.FilterExpression("lastName", "REGEX", hack + "[a-zA-Z_0-9_\\s]*");
	 var feCombined = new blackberry.find.FilterExpression(feFname, "OR",feLname);

     var result = blackberry.pim.Contact.find(feCombined, "firstName", null, null, true);
	 

 any idea how i could get this to work. Not every one enters a first name when they are adding contacts in their contacts.