It is an "int" format in SQL. It is the po histroy date field in macola. I tried timevalue(timefield) and it came up with the same time acroos the board?? I think I can just use the max function without converting this field to pick the most recent record in PO history header.
I did the following 4 formula's in crystal though they probably could be combined
--Hour--
if len(ToText({IMINVTRX_SQL.trx_tm},0,"","") = 6 then
tonumber(left(ToText({IMINVTRX_SQL.trx_tm},0,"","",2)) else
tonumber(left(ToText({IMINVTRX_SQL.trx_tm},0,"","",1))
--Minute--
if len(ToText({IMINVTRX_SQL.trx_tm},0,"","") = 6 then
tonumber(mid(ToText({IMINVTRX_SQL.trx_tm},0,"","",3,2)) else
tonumber(mid(ToText({IMINVTRX_SQL.trx_tm},0,"","",2,2))
--Second--
if len(ToText({IMINVTRX_SQL.trx_tm},0,"","") = 6 then
tonumber(mid(ToText({IMINVTRX_SQL.trx_tm},0,"","",5,2)) else
tonumber(mid(ToText({IMINVTRX_SQL.trx_tm},0,"","",4,2))
Selecting the Max(Hst)Tm) field (by itself) will not return the last record written to the table since a record may have been written later in the day on an earlier day!
To select the last record written today or the last record for a specific PO, you could select Max(Hst_Tm) Where Hst_Dt = <Today> or Where Ord_No = <My PO No>, etc.
Another reliable way to select the last record in a table is to selct the Max(A4GLIdentity) column. This is an ID column that will always be incremented by SQL.
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.