Android Question B4XTable CreateDataView with Multi Line Selection

Mahares

Expert
Licensed User
Longtime User
Trying to create a data view on a B4XTable after a I select Multiple_Lines mode so I can see only the selected lines (rows). Although I tried all the below options to create a data view knowing that none of them would work, I can create a CSV file with the selected lines in another code, but not a view.
B4X:
Sub btnCreateView_Click
   ' Dim Col2 As B4XTableColumn =  B4XTable1.GetColumn("Name")
   ' B4XTable1.CreateDataView($"${Col2.SQLID}<> "" AND XSelections.Mode = XSelections.MODE_MULTIPLE_LINES "$  )
    
'    B4XTable1.CreateDataView(XSelections.SelectedLines.Size > 0)

'    B4XTable1.CreateDataView(XSelections.SelectedLines.Keys.Size> 0)

'    B4XTable1.CreateDataView(XSelections.IsSelected)
    B4XTable1.ClearDataView
End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Link: https://www.b4x.com/android/forum/t...extended-selection-modes-for-b4xtable.114294/
You are confusing different things. CreateDataView works with the memory database and has no relation with XSelections.
You need to do the job to take the selected rowids and build a query:
B4X:
Sub btnFilterSelection_Click
    If XSelections.IsSelected = False Then Return
    Dim sb As StringBuilder
    sb.Initialize
    For Each rowid As Long In XSelections.SelectedLines.Keys
        If sb.Length > 0 Then sb.Append(" or ")
        sb.Append("rowid = ").Append(rowid)
    Next
    B4XTable1.CreateDataView(sb.ToString)
End Sub
 
Upvote 0
Top