Android Question Error Message at B4XTable while CREATE TABLE

Bob Spielen

Active Member
Licensed User
Hello, getting error message at .... B4XTable1.SetData(Data) .... , can someone help me with orientations?




Clipped all to the clipboard:



Logger connected to: asus ASUS_X008D
--------- beginning of crash
--------- beginning of main
*** Service (starter) Create ***
Starter Service_Create
--------- beginning of system
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Antes do StarterLiberou
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
*** Service (enviaerro) Create ***
** Service (enviaerro) Start **
DiaI = 11/03/2020 00:00:00
DiaF = 10/04/2020 23:59:59
*** Service (srvnewdb) Create ***
** Service (srvnewdb) Start **
** Activity (main) Resume **
Stop
AbrePage1
********************************* MontaSpins ******
SoCLV *********
******************* PareaBotoesTeste
Não Definido
Pareou Botões .............................................
******************** SoCLV Fim
*** Service (jornauploader) Create ***
** Service (jornauploader) Start **
AbrePage1
********************************* MontaSpins ******
Stop
Stop 1
TotJornas = 26
SoCLV *********
******************* PareaBotoesTeste
Não Definido
Pareou Botões .............................................
******************** SoCLV Fim
** Activity (main) Pause, UserClosed = false **
*** Service (agenda) Create ***
** Service (agenda) Start **
Stop
IStr = 3
D1 = true
N1 = 12/03/20 09:40:00
N2 = 12/03/20 17:30:00
N1_.Str = 12/03/20 09:40:00
N2_.Str = 12/03/20 17:30:00
** Activity (relatrs) Create, isFirst = true **
********************************* Monta ColSpin ******
** Activity (relatrs) Resume **
Stop
IStr = 4
D1 = true
N1 = 12/03/20 09:40:00
N2 = 12/03/20 17:30:00
N1_.Str = 13/03/20 09:40:00
N2_.Str = 13/03/20 17:30:00
Stop
IStr = 5
D1 = true
N1 = 12/03/20 09:40:00
N2 = 12/03/20 17:30:00
N1_.Str = 14/03/20 09:40:00
N2_.Str = 14/03/20 17:30:00
Stop
IStr = 6
D1 = true
N1 = 12/03/20 09:40:00
N2 = 12/03/20 17:30:00
N1_.Str = 15/03/20 09:40:00
N2_.Str = 15/03/20 17:30:00
Stop
IStr = 7
D1 = false
Stop
IStr = 1
D1 = false
Stop
IStr = 2
D1 = true
N1 = 12/03/20 09:40:00
N2 = 12/03/20 17:30:00
N1_.Str = 18/03/20 09:40:00
N2_.Str = 18/03/20 17:30:00
DiasNaFrente = 6
ProxAlarme_.Str = 18/03/20 09:40:00
No ServiceStart 18/03 09:40:00
Rearme Alarme
Agendado para : 18/03 09:40
** Service (agenda) Destroy **
IdColega = 5
Data Inicial Relat = 2020-01-11 00:00:00
Data Final Relat = 2020-02-10 23:59:59
** Activity (relatrs) Pause, UserClosed = false **
** Activity (relatrs) Create, isFirst = false **
********************************* Monta ColSpin ******
** Activity (relatrs) Resume **
*** Service (sgetcloud) Create ***
** Service (sgetcloud) Start **
Query = SELECT data, ti , tf , ttotf, tviagf , ttrabf , tcompf , tferias , rh70f , rh110f , bh70f , bh110f , anvf, antf, devef, faltou FROM scholle1.dp;
Job.GetString in Success=[{"data":"11\/02\/20","ti":"07:30","tf":"17:00","ttotf":"09:30","tviagf":"","ttrabf":"09:30","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"12\/02\/20","ti":"10:30","tf":"19:30","ttotf":"09:00","tviagf":"","ttrabf":"09:00","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"00:30","faltou":""},{"data":"13\/02\/20","ti":"10:30","tf":"19:00","ttotf":"08:30","tviagf":"","ttrabf":"08:30","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"01:00","faltou":""},{"data":"14\/02\/20","ti":"07:30","tf":"17:30","ttotf":"10:00","tviagf":"","ttrabf":"10:00","tcompf":"","tferias":"","rh70f":"00:30","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"15\/02\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttrabf":"","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"16\/02\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttrabf":"","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"17\/02\/20","ti":"13:00","tf":"21:30","ttotf":"08:30","tviagf":"","ttrabf":"08:30","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"01:00","faltou":""},{"data":"18\/02\/20","ti":"08:00","tf":"17:30","ttotf":"09:30","tviagf":"","ttrabf":"09:30","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"19\/02\/20","ti":"13:00","tf":"23:59","ttotf":"08:59","tviagf":"04:29","ttrabf":"04:30","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"00:01","antf":"","devef":"00:30","faltou":""},{"data":"20\/02\/20","ti":"00:00","tf":"23:59","ttotf":"15:29","tviagf":"01:30","ttrabf":"13:59","tcompf":"","tferias":"","rh70f":"04:29","rh110f":"","bh70f":"","bh110f":"","anvf":"00:01","antf":"00:01","devef":"","faltou":""},{"data":"21\/02\/20","ti":"00:00","tf":"12:00","ttotf":"11:59","tviagf":"08:19","ttrabf":"03:40","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"02:29","bh110f":"","anvf":"00:01","antf":"00:03","devef":"","faltou":""},{"data":"22\/02\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttrabf":"","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"23\/02\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttrabf":"","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"24\/02\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttrabf":"","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"09:30","faltou":"Faltou"},{"data":"25\/02\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttrabf":"","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"09:30","faltou":"Faltou"},{"data":"26\/02\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttrabf":"","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"09:30","faltou":"Faltou"},{"data":"27\/02\/20","ti":"08:00","tf":"17:30","ttotf":"09:30","tviagf":"","ttrabf":"09:30","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"28\/02\/20","ti":"08:00","tf":"17:30","ttotf":"09:30","tviagf":"","ttrabf":"09:30","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"29\/02\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttrabf":"","tcompf":"","tferias":"","rh70f":"","rh110f":"","bh70f":"","bh110f":"","anvf":"","antf":"","devef":"","faltou":""},{"data":"01\/03\/20","ti":"00:00","tf":"00:00","ttotf":"","tviagf":"","ttra
Message longer than Log limit (4000). Message was truncated.
Error occurred on line: 635 (B4XTable)
android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: CREATE TABLE data )
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:905)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:516)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1705)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1636)
at anywheresoftware.b4a.sql.SQL.ExecNonQuery(SQL.java:74)
at com.scholle.hp.b4xtable._createtable(b4xtable.java:2172)
at com.scholle.hp.b4xtable$ResumableSub_SetData.resume(b4xtable.java:361)
at com.scholle.hp.b4xtable._setdata(b4xtable.java:300)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:250)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
at anywheresoftware.b4a.BA$2.run(BA.java:370)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:208)
at android.app.ActivityThread.main(ActivityThread.java:6267)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
 

Attachments

  • 1584449970334.png
    1584449970334.png
    23 KB · Views: 211
Last edited:

Bob Spielen

Active Member
Licensed User
Thanks for the reply, the project is huge
But what am I doing is ... Populating a list of maps "Data" with Row(16) as Object and finally B4XTable1.setData(Data)

B4X:
If LOM.IsInitialized = True Then
        
        If LOM.Size=0 Then '
            
            
        Else
            For i=0 To LOM.Size-1
                '            0      1    2     3     4         5       6         7        8        9      10      11       12         13    14        15
                'TAB     dp: data,  ti , tf , ttotf, tviagf , ttrabf , tcompf , tferias , rh70f , rh110f , bh70f , bh110f , anvf   ,   antf , devef , faltou
                M  =  LOM.Get(i)
                Dim row(16) As Object
                row(0) = M.Get("data")
                row(1) = M.Get("ti")
                row(2) = M.Get("tf")
                row(3) = M.Get("ttotf")
                row(4) = M.Get("tviagf")
                row(5) = M.Get("ttrabf")
                row(6) = M.Get("tcompf")
                row(7) = M.Get("tferias")
                row(8) = M.Get("rh70f")
                row(9) = M.Get("rh110f")
                row(10) = M.Get("bh70f")
                row(11) = M.Get("bh110f")
                row(12) = M.Get("anvf")
                row(13) = M.Get("antf")
                row(14) = M.Get("devef")
                row(15) = M.Get("faltou")
                Data.Add(row)
            Next
            
                
            B4XTable1.SetData(Data)
            
            'B4XTable1: Data, Inic, Fim, TTot, TViag  , TTrab  , TComp  , Ferias  , He70  , He110  , Bh70  , Bh110  , AnViag , AnTrab , Deve  , Falta
            IdColmn(0) = B4XTable1.GetColumn("Data")
            IdColmn(0).Width = 8%x
            IdColmn(1) = B4XTable1.GetColumn("Inic")
            IdColmn(1).Width = 17%x        
            IdColmn(2) = B4XTable1.GetColumn("Fim")
            IdColmn(2).Width = 20%x
            IdColmn(3) = B4XTable1.GetColumn("TTot")
            IdColmn(3).Width = 20%x
            IdColmn(4) = B4XTable1.GetColumn("Tviag")
            IdColmn(4).Width = 70%x
            IdColmn(5) = B4XTable1.GetColumn("TTrab")
            IdColmn(5).Width = 35%x
            IdColmn(6) = B4XTable1.GetColumn("TComp")
            IdColmn(6).Width = 15%x
            IdColmn(7) = B4XTable1.GetColumn("Ferias")
            IdColmn(7).Width = 12%x
            IdColmn(8) = B4XTable1.GetColumn("He70")
            IdColmn(8).Width = 17%x
            IdColmn(9) = B4XTable1.GetColumn("He110")
            IdColmn(9).Width = 10%x
            IdColmn(8) = B4XTable1.GetColumn("Bh70")
            IdColmn(8).Width = 17%x
            IdColmn(9) = B4XTable1.GetColumn("Bh110")
            IdColmn(9).Width = 10%x
            IdColmn(8) = B4XTable1.GetColumn("AnViag")
            IdColmn(8).Width = 17%x
            IdColmn(9) = B4XTable1.GetColumn("AnTrab")
            IdColmn(9).Width = 10%x
            IdColmn(8) = B4XTable1.GetColumn("Deve")
            IdColmn(8).Width = 17%x
            IdColmn(9) = B4XTable1.GetColumn("Falta")
            IdColmn(9).Width = 10%x
            
            '-------------------------------   Paginação -----------------------------
            Dim MaxR As Int
            If i>=5 Then
                MaxR = 5
            Else
                MaxR = LOM.Size
            End If
            B4XTable1.MaximumRowsPerPage = MaxR
            '-------------------------------   Paginação -----------------------------
        End If
        
        
        
        '                           portrait  landscape  
        Log("100%x = " & 100%x)     ' 720        1184
        Log("100%y = " & 100%y)        '1136         672
        
        
        If 100%x < 100%y Then     '     Portrait
            B4XTable1.RowHeight=40dip    
        Else                     '    Landscape    
            B4XTable1.RowHeight=50dip
        End If
        '
        B4XTable1.Refresh
                
    End If
 
Upvote 0

Bob Spielen

Active Member
Licensed User
Have you added 16 columns with B4XTable.AddColumn?
Yes I did pls take a look at the attached file at the Sub RelatCompleto As ResumableSub
The problem comes up
at line....
B4XTable1.SetData(Data)
 

Attachments

  • RelatRS.bas
    21.3 KB · Views: 253
Upvote 0

Mahares

Expert
Licensed User
Longtime User
.I forgot the sleep(0) comand....
I have an idea where the Sleep(0) should go, but if you tell us exactly where you put it in the code, that will help us all if we encounter a similar problem.
Also:
Just an idea to reduce the number of code lines, especially when you have a very big project like this one, you could have saved a lot of code lines by using something like this:
B4X:
Dim NumbCol As Int=16
    Dim Idcolmn(NumbCol) As B4XTableColumn
    Dim ColName(NumbCol) As String =Array As String("Data", "Inic", "Fim", ...., "Falta")
    'you could have also ran a small query on the table to extract the ColName, but apparently you used different names for some
    Dim ColWidth(NumbCol) As Int =Array As Int(8%x, 17%x, 20%x, ......., 10%x)
    For i= 0 To NumbCol -1
        Idcolmn(i) = B4XTable1.AddColumn( ColName(i), B4XTable1.COLUMN_TYPE_TEXT).Width = ColWidth(i)
    Next
 
Upvote 0

Bob Spielen

Active Member
Licensed User
I have an idea where the Sleep(0) should go, but if you tell us exactly where you put it in the code, that will help us all if we encounter a similar problem.
.........
Thank you so much for the tip, I saved it and will for sure replicate it in my projects!
Im using the sleep(0) allways after comands on the B4XTable since sleep(0) "zero" is not to much time..., so I allow B4XTable to react in the layout......
 
Upvote 0
Top