I use the below code with ExecQueryAsync and a search using B4XFloatTextField1_TextChanged. Since the xCLV data is updated frequently and every character entered, is it more appropriate to use ExecQuery/ExecQuery2 as opposed to ExecQueryAsync.
I saw in another thread, that it was recommended not to use the Async method when data is updated, frequently.
B4X:
Sub B4XFloatTextField1_TextChanged (Old As String, New As String)
Dim SenderFilter As Object
If New.Length = 0 And Old.Length > = 1 Then
SenderFilter = Starter.sql.ExecQueryAsync("SQL", $"SELECT DISTINCT Num FROM ${TableName} "$, Null)
Else if New.Length > = 1 Then
SenderFilter = Starter.sql.ExecQueryAsync("SQL", $"SELECT DISTINCT Num
FROM ${TableName} WHERE lower(Num) LIKE ? ORDER BY Num, Name"$, Array As String($"%${New.ToLowerCase}%"$) )
End If
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs1 As ResultSet)