B4J Question (S O L V E D ] column types in b4xtable

afields

Member
Licensed User
hello to all!
i'm using b4xtable and also a preferenceDialog.
i use a time field in the formbuilder.
which column type must i declare in the b4xtable?
thank you!
 

jimmyF

Active Member
Licensed User
I use B4XTable1.COLUMN_TYPE_TEXT

You will need to use these subs:

B4X:
'In your ShowDialog sub
'params.AddAll(.....,TimePeriodToString(Item.Get("Time")),...)
Sub TimePeriodToString (p As Period) As String
    Return $"$1.0{p.Hours}:$2.0{p.Minutes}"$
End Sub

Sub StringToTimePeriod (s As String) As Period
    Dim m As Matcher = Regex.Matcher("(\d+):(\d+)", s)
    Dim p As Period
    If m.Find Then
        p.Initialize
        p.Hours = m.Group(1)
        p.Minutes = m.Group(2)
    Else
        Log("Invalid time string: " & s)
    End If
    Return p
End Sub
-j
 
Top