Good day to all,
I have code below. Everything is ok except when using kvs.get(), which I could not get every item on the list.
Thank you for your kind reply.
I have code below. Everything is ok except when using kvs.get(), which I could not get every item on the list.
Thank you for your kind reply.
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#AdditionalJar: bcprov-jdk15on-154
#AdditionalJar: sqlite-jdbc-3.7.2
#End Region
Sub Process_Globals
Public kvs As KeyValueStore
Dim su As StringUtils
End Sub
Sub AppStart (Args() As String)
'--------------------------------------------------------------------
Dim folder As String = File.DirApp
kvs.Initialize(folder, "datastore")
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'delete all data
kvs.DeleteAll
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'put a "simple" value
kvs.Put("time", DateTime.Now)
'get it
Dim xtime As String = kvs.Get("time")
Log(DateTime.Time(xtime))
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'this ok!
Dim s As String
Dim list1 As List = su.LoadCSV(File.DirAssets, "product.csv",",")
For Each row() As String In list1
s=""
For Each n As String In row
s=s & " " & n
Next
s = s & CRLF
'Log(s)
Next
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'put it on kvs
kvs.put("test", list1)
Dim s As String
'list it
For Each row() As String In list1
s=""
For Each n As String In row
s=s & " " & n
Next
s = s & CRLF
Log(s)
Next
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'get
'and here lies the problem
Dim s2 As String=""
Dim list2 As List = kvs.Get("test")
For Each row() As String In list2
s2=""
For Each n As String In row
s2=s2 & " " & n
Next
s2 = s2 & CRLF
Log(s2)
Next
'--------------------------------------------------------------------
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub