LucaMs Expert Licensed User Longtime User Jun 3, 2024 #1 B4XTable: How to check if a DataView has been created (data is filtered)?
Erel B4X founder Staff member Licensed User Longtime User Jun 4, 2024 #2 Not sure that I understand the question. It is your code that creates the data view (B4XTable.CreateDataView). Upvote 0
Not sure that I understand the question. It is your code that creates the data view (B4XTable.CreateDataView).
LucaMs Expert Licensed User Longtime User Jun 4, 2024 #3 Erel said: Not sure that I understand the question. It is your code that creates the data view (B4XTable.CreateDataView). Click to expand... Yes, I set the DataView but at that point, if I want to execute a query on the DB internal to the B4XTable (sql1), I don't know whether the DataView (the view on the table) is active or not, so if in the query write: ... From 'TempView' or From 'data'. I can use a boolean global variable to do the checking but, like all global variables, it is best to avoid them, for known reasons. A read-only Boolean property based on the private variable SQLTableName would be enough: Return SQLTableName = "TempView". Upvote 0
Erel said: Not sure that I understand the question. It is your code that creates the data view (B4XTable.CreateDataView). Click to expand... Yes, I set the DataView but at that point, if I want to execute a query on the DB internal to the B4XTable (sql1), I don't know whether the DataView (the view on the table) is active or not, so if in the query write: ... From 'TempView' or From 'data'. I can use a boolean global variable to do the checking but, like all global variables, it is best to avoid them, for known reasons. A read-only Boolean property based on the private variable SQLTableName would be enough: Return SQLTableName = "TempView".
Erel B4X founder Staff member Licensed User Longtime User Jun 4, 2024 #4 For now you can use this hack: Code: Private Sub IsDataViewApplied As Boolean Dim query As String = B4XTable1.BuildQuery(False)(0) Return query.Contains("FROM TempView") End Sub Upvote 0
For now you can use this hack: Code: Private Sub IsDataViewApplied As Boolean Dim query As String = B4XTable1.BuildQuery(False)(0) Return query.Contains("FROM TempView") End Sub
LucaMs Expert Licensed User Longtime User Jun 4, 2024 #5 Erel said: For now you can use this hack: Code: Private Sub IsDataViewApplied As Boolean Dim query As String = B4XTable1.BuildQuery(False)(0) Return query.Contains("FROM TempView") End Sub Click to expand... Very helpful. Thanks, Erel Upvote 0
Erel said: For now you can use this hack: Code: Private Sub IsDataViewApplied As Boolean Dim query As String = B4XTable1.BuildQuery(False)(0) Return query.Contains("FROM TempView") End Sub Click to expand... Very helpful. Thanks, Erel