Android Tutorial two dimensional database/reports

anuj0sharma

Member
Licensed User
Hello Everyone,
wants to have a two dimensional database.
Is it feasible using the great DBUtils by Erel.

the table should look like this..



if, storing in 2D is not possible, then how can we use DBUtils with webView to generate similar looking report.

any suggestions are welcome.

Regards,
 

Attachments

Erel

Administrator
Staff member
Licensed User
DBUtils.ExecuteHtml creates Html tables. Using DBUtils you can create the required database and then display such a table.

B4X:
Sub Process_Globals
    Dim SQL As SQL
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        SQL.Initialize(File.DirRootExternal, "1.db", True)
    End If
    Dim m As Map
    m.Initialize
    m.Put("Device", DBUtils.DB_TEXT)
    m.Put("Param 1", DBUtils.DB_TEXT)
    m.Put("Param 2", DBUtils.DB_TEXT)
    m.Put("Param 3", DBUtils.DB_TEXT)
    DBUtils.DropTable(SQL, "devices")
    DBUtils.CreateTable(SQL, "devices", m, "Device")
    Dim List As List
    List.Initialize
    For i = 1 To 100
        Dim values As Map
        values.Initialize
        values.Put("Device", "Device " & i)
        values.Put("Param 1", i)
        values.Put("Param 2", i * 3)
        values.Put("Param 3", i * 5)
        List.Add(values)
    Next
    DBUtils.InsertMaps(SQL, "devices", List)
    
    Dim wv As WebView
    wv.Initialize("")
    activity.AddView(wv, 0, 0, 100%x, 100%y)
    wv.LoadHtml(DBUtils.ExecuteHtml(SQL, "SELECT * FROM devices", Null, 0))
End Sub
 
Top