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

Discussion in 'B4J Questions' started by afields, Jul 16, 2019.

  1. afields

    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!
     
  2. jimmyF

    jimmyF Active Member Licensed User

    I use B4XTable1.COLUMN_TYPE_TEXT

    You will need to use these subs:

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

    Sub StringToTimePeriod (s As StringAs 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
     
  3. afields

    afields Member Licensed User

    Thank you!
     
    jimmyF likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice