peacemaker Expert Licensed User Longtime User Feb 3, 2017 #1 HI, All I have found that my contacts were saved sometimes without delimiters like "12345678", but sometimes with spaces and\or "-" like "123 45-678". And note that i did not enter these delimiters - it seems to be due to various Android versions saved contacts into the Google account such ways. BTW, the calls log shows all numbers all without delimiters. And now, when i try to .FindContactsByPhone - saved contact with number "12345678" is not found by the first time. And the calls log shows this incoming call number as unknown, without a name. But if to make a new call and search second time - it's found among contacts ! And calls log also shows the contact name together with this number. How to understand it and to be sure that delimiters are not used during finding process ? Last edited: Feb 3, 2017
HI, All I have found that my contacts were saved sometimes without delimiters like "12345678", but sometimes with spaces and\or "-" like "123 45-678". And note that i did not enter these delimiters - it seems to be due to various Android versions saved contacts into the Google account such ways. BTW, the calls log shows all numbers all without delimiters. And now, when i try to .FindContactsByPhone - saved contact with number "12345678" is not found by the first time. And the calls log shows this incoming call number as unknown, without a name. But if to make a new call and search second time - it's found among contacts ! And calls log also shows the contact name together with this number. How to understand it and to be sure that delimiters are not used during finding process ?
peacemaker Expert Licensed User Longtime User Feb 3, 2017 #2 More over - some contacts are with "(XXX)" So, it needs to modify searching by phone number by this ContactsUtils class. Now it can be only by 1) .FindAllContacts 2) iterating cuContacts 3) iterating cuPhones of each cuContact 4) removing "+", " ", "-", "(", ")" in each cuPhone 5) and only here to compare the number with needed one Such searching is several seconds at last, very long How to make SQL request with removing these ? Upvote 0
More over - some contacts are with "(XXX)" So, it needs to modify searching by phone number by this ContactsUtils class. Now it can be only by 1) .FindAllContacts 2) iterating cuContacts 3) iterating cuPhones of each cuContact 4) removing "+", " ", "-", "(", ")" in each cuPhone 5) and only here to compare the number with needed one Such searching is several seconds at last, very long How to make SQL request with removing these ?
Erel B4X founder Staff member Licensed User Longtime User Feb 5, 2017 #3 You can do something like: Code: Dim possibleContacts As List = cu.FindContactsByPhone(PhoneNumber.Substring(PhoneNumber.Length - 3), False, True) This will return all the contacts with a phone number that contains the last three digits. Now go over the list and find out the matches. Upvote 0
You can do something like: Code: Dim possibleContacts As List = cu.FindContactsByPhone(PhoneNumber.Substring(PhoneNumber.Length - 3), False, True) This will return all the contacts with a phone number that contains the last three digits. Now go over the list and find out the matches.
peacemaker Expert Licensed User Longtime User Feb 5, 2017 #4 Yes, Erel, thanks, but it's not universal way. It will be for sure if to select the latest one digit only firstly But no way to filter by SQL request ? Upvote 0
Yes, Erel, thanks, but it's not universal way. It will be for sure if to select the latest one digit only firstly But no way to filter by SQL request ?
Erel B4X founder Staff member Licensed User Longtime User Feb 5, 2017 #5 This is no SQL engine there. It just looks like SQL. peacemaker said: It will be for sure if to select the latest one digit only firstly Click to expand... This will not help much as it will only remove a few items. Upvote 0
This is no SQL engine there. It just looks like SQL. peacemaker said: It will be for sure if to select the latest one digit only firstly Click to expand... This will not help much as it will only remove a few items.