Android Question GPS decimals are missing

Tom1s

Member
Licensed User
Longtime User
Hi

I can't figure out why i can't get enough decimals to show.



B4X:
Dim s As String=SQL1.ExecQuerySingleResult("Select GPSLat FROM table")
Log("GPSlat"&s)

gives GPSlat60.4342

But with computer/SQLlitebrowser I can see that in DBtable there is 60.43415816
 

eurojam

Well-Known Member
Licensed User
Longtime User
I would suggest to use
B4X:
Dim s AsString=NumberFormat(SQL1.ExecQuerySingleResult("Select GPSLat FROM table"),0,8)
instead.
 
Upvote 0

Tom1s

Member
Licensed User
Longtime User
Hmm Ok.

I think it would not work if SQL query is something like
B4X:
CursorLog =SQL1.ExecQuery("Select Time,GPSLat,GPSLon,Status from table") ?
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
No it would not work, but what I am wanted to show is, that the problem is not the query, it is the assignment to a string variable. If you want to do this, yould should use the NumberFormat to achieve the correct format of your double values. So if you use a recordset with more then one column, you have to loop trough and do it like this.

best regards
stefan
 
Upvote 0

Tom1s

Member
Licensed User
Longtime User
Ok

I am trying to send these to server with RDC.
Should I try to fetch gPS coordinates and the rest on separate sentences?
cursorlog= numberformat(SQL.execquery("select GPSLat FROM table"),0,8)
cursorlog= numberformat(SQL.execquery("select GPSLon FROM table"),0,8)
CursorLog =SQL1.ExecQuery("Select Time,Status FROM table")


B4X:
 Uploads

Dim CursorLog As Cursor
Dim i As Int

CursorLog =SQL1.ExecQuery("Select Time,GPSLat,GPSLon,Status FROM table")
Dim commands As List
commands.Initialize
For i = 0 To CursorLog.RowCount - 1
CursorLog.Position = i
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "upload"

cmd.Parameters = Array(CursorLog.GetString("Time"),CursorLog.GetString("GPSLat"),CursorLog.GetString("GPSLon"),CursorLog.GetString("Status"))
commands.Add(cmd)

Next
reqManager.ExecuteBatch(commands,"upload")
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
wy don't you use
B4X:
cmd.Parameters = Array(CursorLog.GetString("Time"), CursorLog.GetDouble("GPSLat"),CursorLog.GetDouble("GPSLon"),CursorLog.GetString("Status"))
?
 
Upvote 0

Tom1s

Member
Licensed User
Longtime User
wy don't you use
B4X:
cmd.Parameters = Array(CursorLog.GetString("Time"), CursorLog.GetDouble("GPSLat"),CursorLog.GetDouble("GPSLon"),CursorLog.GetString("Status"))
?
:oops:
Because now I use and it works! ;)
Thanks!
 
Upvote 0
Top