This is really convoluted:
The field I'm trying to summarize is {@elapsed Time in OR} = tonumber(DateDiff("n",{@Reported In OR Time},{@Reported Out OR Time})) .
{@Reported In OR Time} = if isnull(maximum({@Recorded In OR Time}, {OR_LOG.LOG_ID}))
then {@x null datetime} //i.e. don't display anything
else ((maximum({@Recorded In OR Time},{OR_LOG.LOG_ID})))
{@Reported Out OR Time} = if isnull(maximum({@Recorded Out OR Time}, {OR_LOG.LOG_ID}))
then {@x null datetime} //i.e. don't display anything
else ((maximum({@Recorded Out OR Time},{OR_LOG.LOG_ID})))
{@Recorded In OR Time} = if ({OR_LOG_CASE_TIMES.TRACKING_EVENT_C} in [60]) then
if not isnull({OR_LOG_CASE_TIMES.TRACKING_TIME_IN}) then
{OR_LOG_CASE_TIMES.TRACKING_TIME_IN}
else {@x null datetime}
else {@x null datetime}
{@Recorded Out OR Time} = if ({OR_LOG_CASE_TIMES.TRACKING_EVENT_C} in [110]) then
if not isnull({OR_LOG_CASE_TIMES.TRACKING_TIME_IN}) then
{OR_LOG_CASE_TIMES.TRACKING_TIME_IN}
else {@x null datetime}
else {@x null datetime}
The field I'm trying to summarize is {@elapsed Time in OR} = tonumber(DateDiff("n",{@Reported In OR Time},{@Reported Out OR Time})) .
{@Reported In OR Time} = if isnull(maximum({@Recorded In OR Time}, {OR_LOG.LOG_ID}))
then {@x null datetime} //i.e. don't display anything
else ((maximum({@Recorded In OR Time},{OR_LOG.LOG_ID})))
{@Reported Out OR Time} = if isnull(maximum({@Recorded Out OR Time}, {OR_LOG.LOG_ID}))
then {@x null datetime} //i.e. don't display anything
else ((maximum({@Recorded Out OR Time},{OR_LOG.LOG_ID})))
{@Recorded In OR Time} = if ({OR_LOG_CASE_TIMES.TRACKING_EVENT_C} in [60]) then
if not isnull({OR_LOG_CASE_TIMES.TRACKING_TIME_IN}) then
{OR_LOG_CASE_TIMES.TRACKING_TIME_IN}
else {@x null datetime}
else {@x null datetime}
{@Recorded Out OR Time} = if ({OR_LOG_CASE_TIMES.TRACKING_EVENT_C} in [110]) then
if not isnull({OR_LOG_CASE_TIMES.TRACKING_TIME_IN}) then
{OR_LOG_CASE_TIMES.TRACKING_TIME_IN}
else {@x null datetime}
else {@x null datetime}