Android Question B4XTable: Search for uppercase Cyrillic characters

Genricke

Member
H !

B4XTable.
I have a problem with searching in the national encoding (Russian) by uppercase characters.
Do you need to configure something ?

Search for any English content in the table - no problem.
Search for lowercase Russian characters - no problem.

I know how to make a hidden column of lowercase content specifically just for search - but this is a strange solution.
Thanks ! Maybe there is a working example ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You have two options, both require using and modifying the source code of B4XTable (b4xlib = zip).

The cause of this is explained here: https://www.b4x.com/android/forum/t...-searches-with-non-ascii-text.122582/#content

1.Change line 952:
B4X:
Dim term As String = New.ToLowerCase
To:
B4X:
Dim term As String = New

This will cause the search to be case sensitive but should work.

2. Implement the solution suggested in the above link. It should be done in BuildQuery. It is not trivial as the code of B4XTable is quite complex.
 
Upvote 0

Genricke

Member
It is not trivial as the code of B4XTable is quite complex

Thanks ! I will try to do this ...
Is it possible in the future to make the search support for national characters in B4XTable configurable from my code ?
I'm afraid that my interference with your code may cause harm.
 
Upvote 0

Genricke

Member
You have two options

1. It works ! But without highlighting in the list and depends on the case.

2. I don't understand how the recursive SUB call works in B4A.
Can I request a BuildQuery example with an international search ?

Thank you for your help !
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Can I request a BuildQuery example with an international search ?
Maybe I am biting more than I can chew here because I know nothing about Cyrillic, but are you looking for B4XTable BuildQuery, something like this:
B4X:
Private Sub btn1_Click
    Dim o() As Object = B4XTable1.BuildQuery(False) 
    Dim s As String ="SELECT * FROM data WHERE c0 LIKE ?"  'c0 is the first column name in the in memory database
    o(0)=s
    o(1)=Array As String ("%Ме%")  'cyrillic letters
    Dim rs As ResultSet = B4XTable1.sql1.ExecQuery2(o(0), o(1))
    Do While rs.NextRow
        Log(rs.GetString("c0"))
    Loop
    rs.Close
End Sub
 
Upvote 0

Genricke

Member
Thanks ! Already done, I understood how it works.
The search remains case-sensitive for Russian text, but I realized that this is a SQLite problem.

I solved the question through a hidden column in the table with the text in lowercase and entering the query string forcibly in lowercase.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…