Hi, I have a strange error when I try to feed the table, I simply get data from an API and insert it in a table but it returns an error that I have no idea what it means, since I do not use SQLite.
My code just feed the table with the JSON results:
To the top:
B4X:
Error occurred on line: 601 (B4XTable)
android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: CREATE TABLE data )
My code just feed the table with the JSON results:
B4X:
{"orders":[{"id_pedido":5,"fecha":"2019-06-24T08:03:26.000Z","producto":"Horchata de canela 3.785 L","cantidad":5,"total":"825.00"},{"id_pedido":5,"fecha":"2019-06-24T08:03:26.000Z","producto":"Jamaica 700ml","cantidad":2,"total":"58.00"}],"successful":true}
To the top:
B4X:
Table.AddColumn("col1", Table.COLUMN_TYPE_TEXT)
Table.AddColumn("col2", Table.COLUMN_TYPE_TEXT)
B4X:
ProgressDialogShow("OBTENIENDO DETALLE DEL PEDIDO")
Dim Data As Map
Data.Initialize
Data.Put("id", someID)
Dim JSONGenerator As JSONGenerator
JSONGenerator.Initialize(Data)
Dim JSONString As String
JSONString = JSONGenerator.ToString
HTTP.PostString("http://"&IP&":8081/something", JSONString)
HTTP.GetRequest.SetContentType("application/json")
Wait For (HTTP) JobDone(response As HttpJob)
If response.Success Then
Dim parser As JSONParser
parser.Initialize(response.GetString)
Dim Root As Map = parser.NextObject
Dim Datas As List = Root.Get("datas")
For Each Data As Map In Datas
Dim row(2) As Object
row(0) = Datas.Get("col1")
row(1) = Datas.Get("col2")
DataList.Add(row)
Next
ToastMessageShow("ERROR", True)
End If
HTTP.Release
Table.SetData(DataList)
ProgressDialogHide