Android Question Error: Invalid Double NumberFormatException

swabygw

Active Member
Licensed User
I have a custom Type, like this:
B4X:
Type MyCustomType (UserID As Int, Active As Boolean, EffDt As Long)

I read from a database (msaccess) and load the retrieved values into the custom Type, like this:
B4X:
Dim m As Map
m = rows.Get(i)
Log(m)
Select Job.JobName
  Case "MyJobName"
    Dim pr As MyCustomType
    pr.UserID = m.Get("UserID")
    pr.Active = m.Get("Active")
    pr.EffDt = m.Get("EffDt")
    ListOfMyCustomType.Add(pr)
End Select

My goal is simply to load the ticks into pr.Effdt. I can see from the Log that it has retrieved ticks, which is perfect, but marked the value as a /Date/ - see image. This is okay with me, but it causes an error on the line pr.Effdt=m.Get("EffDt"). Strangely, the error says "Invalid double" even though the datatype of the target field is Long.

upload_2017-1-2_4-16-19.png


This should work, no? Is there another (better) way to load a date?

P.S., my temporary workaround is:
B4X:
Dim s As String = m.Get("EffDt")
s = s.SubString2(6, s.Length-2)
pr.EffDt = s
 
Last edited:

swabygw

Active Member
Licensed User
Interesting - didn't know KeyValueStore2 was that powerful. But, I need to access the data from my web server as the data is viewed/manipulated from a website, too. I thought a database sitting on the web server made the most sense, but now I'm wondering if it would be wiser to use KeyValueStore2 and sync it to my database somehow.
 
Upvote 0
Top