AnsweredAssumed Answered

Delayed executeSQL result?

Question asked by Extensitech on Jan 31, 2016
Latest reply on Feb 1, 2016 by Extensitech

I've found a workaround that doesn't use executeSQL, but I'm not sure why this would happen.

 

Using the function below, I'm trying to query a table of hours to get the most recent clockout time today, for the current user. It works, but sometimes, if the user has just added a clockout time, there's a delay before the result of this expression updates. I triple-checked that the change is committed. I tried a refresh with flush. Where I had it in the data viewer I clicked refresh there, too. Regardless, I get the clockout before last for several seconds, and then I get the correct (most recent) result.


(Background: We're using this to determine the next clock in time, and whether to ask the user, basically, "Where've you been?" so we can catch undocumented breaks or where the user just forgot to clock in to the next work order.)

 

Anyhow, here's the function. Can anyone spot what I'm doing wrong, or point me to the reason why this would behave, well... sluggishly? This was easy enough to work around here, but I'm concerned that I might be missing some detail about esql that could bite me in a more significant way in the future...

 

-------------------------------------------------------------------------------------

Let ( [

x=1

; dat = GetAsDate ( Get ( CurrentHostTimestamp ) )

; tim = GetAsTime ( Get ( CurrentHostTimestamp ) )

; acc = $$ACC_cur

 

; now = Timestamp ( dat ; tim )

; sql =

 

"SELECT (" & Quote ( "A_lm_End" ) & ")"

& "¶FROM " & Quote ( "HOU__Hours" )

& "¶WHERE " & Quote ( "A_d_End" ) & " = ?"

& "¶AND " & Quote ( "A_i_End" ) & " <= ?"

& "¶AND " & Quote ( "_ACC" ) & " = ?"

 

; lst =

 

ExecuteSQL (

  sql

  ; ""

  ; ""

  ; dat

  ; tim

  ; acc

)

 

] ;

 

GetAsTime ( RightWords ( lst ; 1 ) )

 

)

-------------------------------------------------------------------------------------

Chris Cain

Extensitech

Outcomes