B4J Question [ABMaterial] Show formatted date in grid

Harris

Expert
Licensed User
Longtime User
How does one show a long value at formatted data / time in the grid?
I have tried FROM_UNIXTIME(pdate) in the query but col is empty. This is the usual method that I use in Jaspersoft reports query.

I suspect I have to detect what field (from map) and format the value for display (as done with Images).


B4X:
        SQL_Str2 =    "SELECT pk, pdate, filename,  place, drvid FROM cam_pics ORDER BY filename "&" LIMIT "& ((fromPage - 1) * iRecs) & ", "&iRecs

            Dim var As String
            var =     tblFields.GetValueAt(j) ' init as string to avoid null_pointer error
            If var = "null" Then
               var = ""
            End If


               If tblFields.GetKeyAt(j) = "tspare1" Then
                 ' Log("image to get: "&var)
                  Dim img As ABMImage
                  img.Initialize(page , "img"&j&i ,"../images/pics/"&var, 1.0)
                  img.SetFixedSize( 80,60)
                  img.IsCircular = True
                  rCellValues.Add(img)
                  rCellThemes.Add("nocolor")
               Else
                  rCellValues.Add(var)
                  rCellThemes.Add("nocolor")
               End if
 

Harris

Expert
Licensed User
Longtime User
To answer my own (stupid) question:

B4X:
                 If tblFields.GetKeyAt(j) = "pdate" Then
                        Dim pd As ABMLabel
                        pd.Initialize(page,"dt"&j,"",ABM.SIZE_H6,False,"")
                        pd.Text = DateTime.Date(tblFields.GetValueAt(j))&" - "&DateTime.Time(tblFields.GetValueAt(j))
                        rCellValues.Add(pd)
                        rCellThemes.Add("nocolor")
                        Log("  What is date: "&pd.Text)
                  End if
 
Upvote 0
Top