AnsweredAssumed Answered

Forcing timestamp sorting in a relationship

Question asked by dsimonson on Mar 2, 2018
Latest reply on Mar 4, 2018 by dsimonson

We have an anesthesia electronic medical record solution that records patient interactions as observations.  In order to cover anesthetics spanning multiple days, all observations have fields for date, time, and timestamp.


The observation tables are related to the anesthetic table via id_anesthetic.  The relationship is sorted (this is key!) by timestamp.


On my graphic record layout, we display the observations in two ways: portals (obvious) and, not so obvious, by a button bar button that displays a list field (s_med_obs_list) listing a calculation field (c_med_obs_calc) from each of the individual observations. The calc field has the following calculation:


Let ( [

time = #TimeFormat24 ( Obs_Meds::time_med_obs ) ;

med = Obs_Meds::id_med ;

med_amt = Obs_Meds::med_amt;

med_unit =  Obs_Meds::med_unit;

route = Obs_Meds::med_route ;

] ;

time &

" " & med &

" " & med_amt & “ “& med_unit

" " & route



So s_med_obs_list shows a list of the time, medication, and route of administration, like this:


10:32 fentanyl 50 mcg IV

10:35 propofol 100 mg IV

10:40  rocuronium 40 mg IV


In the scripts for adding and editing these observations, the timestamps for the observations are _constructed_ by using Timestamp(g_date; g_time).  To create a new observation, the user enters the date and time into globals and the globals are turned into the time, date, and timestamp entries. 


Here’s the problem I’m having.  When the user taps on the button bar button, it brings up a card window where they can enter a new medication observation _or_ edit an existing one. Adding new ones is no problem, but if they go back and edit an existing one, when they are taken back to the layout the records are no longer in chronological order - they are still in the order they were previously, and the result might look like this:


10:32 fentanyl 50 mcg IV

10:30 propofol 100 mg IV

10:40  rocuronium 40 mg IV


I have tried Refresh Window (Flush cached join results) in the script that runs after the card window is closed (and we are back on the layout in question), but get inconsistent results.  How do I force the relationship to refresh the sort order based upon the newly-edited and changed timestamp?