Hi, me again!
I try to format numbers in the Table to 3 decimal places, but it is not working. If the number is "12345.67", I would like it to display "12345.670", but it is displaying "12345.67"...it makes things look tidy in the Table when numbers all have the same number of decimal places.
Here is my code:
I try to format numbers in the Table to 3 decimal places, but it is not working. If the number is "12345.67", I would like it to display "12345.670", but it is displaying "12345.67"...it makes things look tidy in the Table when numbers all have the same number of decimal places.
Here is my code:
B4X:
[/
Sub ShowTable
SV.Clear
SV.DefaultDataFormatter.GetDefaultFormat.GroupingCharacter = ""
SV.AddColumn("Name", SV.COLUMN_TYPE_TEXT)
SV.AddColumn("East", SV.COLUMN_TYPE_NUMBERS)
SV.AddColumn("North", SV.COLUMN_TYPE_NUMBERS)
SV.AddColumn("Elevation", SV.COLUMN_TYPE_NUMBERS)
SV.AddColumn("Description", SV.COLUMN_TYPE_TEXT)
Dim Data As List
Data.Initialize
If CGlobals.CoordCode=1 Then
'Site Coords
Dim rs As ResultSet = CGlobals.sql1.ExecQuery("SELECT Name, East, North, Elevation, Description FROM SCoords ORDER BY Name ASC")
else if CGlobals.CoordCode=2 Then
'Global Coords
Dim rs As ResultSet = CGlobals.sql1.ExecQuery("SELECT Name, East, North, Elevation, Description FROM GCoords ORDER BY Name ASC")
Else
'Job Coords
Dim rs As ResultSet = CGlobals.sql1.ExecQuery("SELECT Name, East, North, Elevation, Description FROM Coords ORDER BY Name ASC")
End If
Do While rs.NextRow
Dim row(5) As Object
row(0) = rs.GetString("Name")
row(1) = NumberFormat2(rs.GetDouble("East"),1,3,3,False)
row(2) = NumberFormat2(rs.GetDouble("North"),1,3,3,False)
row(3) = NumberFormat2(rs.GetDouble("Elevation"),1,3,3,False)
Try
row(4)= rs.GetString("Description")
If row(4) = Null Then row(4) = ""
Catch
row(4)=""
End Try
Data.Add(row)
Loop
rs.Close
SV.SetData(Data)
End Sub
]