Problem search contact - Contacts2 library

brelto85

Active Member
Licensed User
Longtime User
hi,

I have some problems with the library research contacts
if I try to search for contacts that also connect to facebook (hence name), are found correctly

but if the contact has no link with other networks (facebook, linkedin eccc ..) is not found

B4X:
Dim wName as string
Dim wContacts As Contacts2
Dim wList As List = wContacts.FindByName (wName, False, True, False)

Example 1:

wName:
'rossi'

wList:
Mario Rossi (have a link with facebook)
Carlo Rossi (have a link with facebook)
etc. ...

Example 2:

wName
'pippo'

wList:
empty (although he has a 'pippo' contact in the address book that is not connected to anything)

Is there any parameter to be set or forcing search field?

Alberto
 

brelto85

Active Member
Licensed User
Longtime User
Also if i use GetContactsByQuery doesn't work

Debugging GetContactsByQuery, i notice that the column 'name' is not present in SELECT
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Debugging GetContactsByQuery, i notice that the column 'name' is not present in SELECT
You are correct. You will not be able to query the "name" field with GetContactsByQuery.

The only solution that I can think of is to get all contacts (preferably asynchronously) and then search for the name yourself.
 
Upvote 0

brelto85

Active Member
Licensed User
Longtime User
Continuing to analyze the problem, i noticed that if i search a contact from name, does not find anything

Suppose then that my contacts are (with display_name): "Paolo Rossi", "Carlo Rossi", "pippo"

criteria = "Rossi"
results = "Paolo Rossi", "Carlo Rossi"

criteria = "Paolo"
results = empty

criteria = "pippo"
results = empty

I can maybe try to change some settings in my book to understand the problem?

thanks
 
Upvote 0

brelto85

Active Member
Licensed User
Longtime User
I found the cause!!!!!!
The problem was the space in the name that i passed (that recovered from VoiceRecognition string)

B4X:
Dim wList As List = wContacts.FindByName(Name.Trim, False, True, False)

with ".Trim" method works perfect!!

thanks
Alberto
 
Upvote 0
Top