Android Question RDC InsertMaps

Declan

Well-Known Member
Licensed User
Longtime User
I have an app that reads fields from a remote Microsoft SQL Server database using RDC.
I then insert this data into a local SQLite database on the Android device.
But, when I InsertMaps to insert the data into the local SQLite database, it is very slow.
By code:
B4X:
           If result.Tag = "GetLast30Days" Then 'query tag
               ProgressDialogHide
                LOCALCreateSalesTable
                Msgbox("Table Created","")
                Dim ListOfMaps As List
                    ListOfMaps.Initialize
                For Each row() As Object In result.Rows
                    ListOfMaps.Add(CreateMap("Units_Sold": row(0), "Total_Retail": row(1), "Brand": row(2), "Store": row(3), "Region": row(4), "Sales_Person": row(5), "Sale_Date": row(6)))
                    DBUtils.InsertMaps(SQL1, "sales_end_user", ListOfMaps)
                Next
           End If
Once I have the data in the SQLite table, I "pull" various reports that are displayed in a WebView.
Is there a faster way to accomplish this?
 

DonManfred

Expert
Licensed User
Longtime User
Move the insermaps after the end of the foreach loop
B4X:
Dim ListOfMaps As List
                    ListOfMaps.Initialize
                For Each row() As Object In result.Rows
                    ListOfMaps.Add(CreateMap("Units_Sold": row(0), "Total_Retail": row(1), "Brand": row(2), "Store": row(3), "Region": row(4), "Sales_Person": row(5), "Sale_Date": row(6)))
                Next
                DBUtils.InsertMaps(SQL1, "sales_end_user", ListOfMaps)
 
Upvote 0
Top