Android Question InputListAsync(data,"请选择要编辑的月份:",0,False) List not available?Hope to get help, thank you!

guandjy

Member
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("select_yuefenkongzhi",Array("是"))
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
req.PrintTable(res)
Dim data As List
data.Initialize
For Each row() As Object In res.Rows
Dim val1 As String = row(res.Columns.Get("yuefenkongzhi"))
data.Add(Array(val1))
Next
InputListAsync(data,"请选择要编辑的月份:",0,False)
Wait For InputList_Result (Index As Int)
If Index <> DialogResponse.CANCEL Then
b=data.Get(Index)
End If
 

Mahares

Expert
Licensed User
Longtime User
How to convert the data array in the database into characters?
Maybe this example will help you:
B4X:
    Dim data As List
    data.Initialize
    data.Add(Array ("Paris", "France", "Europe"))
    data.Add(Array ("Kyiv", "Ukraine", "Europe"))
    data.Add(Array ("Cairo", "Egypt", "Africa"))
    data.Add(Array ("Beijing", "China", "Asia"))
    data.Add(Array ("Santiago", "Chili", "America"))

   Dim l As List
    l.Initialize   
    For i=0 To data.Size-1
        Dim r(3) As String =data.Get(i)
        Dim sb As StringBuilder
        sb.Initialize       
        For j=0 To r.Length-1
            If j=r.Length-1 Then
                sb.Append(r(j))
            Else
                sb.Append(r(j)).Append(",")
            End If
        Next
        l.Add(sb.ToString)
    Next
    InputListAsync(l, "Select a place", 0, False)
    Wait For InputList_Result (Index As Int)
    If Index <> DialogResponse.CANCEL Then
        Log("Selected place: " & l.Get(Index))
    End If
You need to put your code inside code tags. It will look a lot better and more readable.
The output will be this:
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
Just remove Array
data.Add(val1)

B4X:
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("SELECT_yuefenkongzhi", Array("是"))
    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        req.PrintTable(res)
        Dim data As List
        data.Initialize
        For Each row() As Object In res.Rows
            Dim val1 As String = row(res.Columns.Get("yuefenkongzhi"))
            data.Add(val1)
        Next
        
        InputListAsync(data, "请选择要编辑的月份:", 0, False)
        Wait For InputList_Result (Index As Int)
        If Index <> DialogResponse.CANCEL Then
            Dim b As String = data.Get(Index)
            Log(b)
        End If
    End If
 
Upvote 0

guandjy

Member
Thank you for your plan. It's great. It works perfectly
 
Upvote 0

guandjy

Member

Thank you, but it still works after deletion. The solution upstairs can be solved
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…