Ok. This is the run down.
I do the reporting and statistics for a call centre and the agents are measured on things such as the time spent working on calls, and after calls.
We are using a Rockwell switch and it is very smart and records every single thing that happens, including touchpad keystrokes and the amount of time spent in particular states like on a call, or in available, or after call work, or on a secondary call etc (these states are controled by buttons on the phone eg. to go into unavailable you press the unavailable button).
In call centre's there is a massive need to moniotor and minimise the amount of time spent in AfterCallWork, so the agents are monitored real time by a guy who watches a screen to see that they don't spend more than 5 mins in AfterCallWork. If the agents go over 5 mins he calls the team leader.
The agents caught on to this so started pressing the unavailable button just before 5 mins in AfterCallWork and then went back to AfterCallWork to avaoid the 5 min threshold.
So to find the people doing this my collegue and I made a report that says "Only display the record if this record is unavailable or available, and the previous record is AfterCallWork and the next record is also AfterCallWork" and then I sum the time.
It looks like this - (3 and 4 are unavailable and available and 5 is AfterCallWork)
@CallWork1
//This is the previous state
if {VW_EVT_AGENT_ACTIVITY.AA_TYPE} in [3,4] and
Previous ({VW_EVT_AGENT_ACTIVITY.AA_TYPE}) IN [5] and
NEXT ({VW_EVT_AGENT_ACTIVITY.AA_TYPE}) IN [5]then
totext (Previous({VW_EVT_AGENT_ACTIVITY.AA_ACTIVITY})+(" "

+RISecondsToHMS(Previous({VW_EVT_AGENT_ACTIVITY.AA_CALL_DURATION})))
else
""
Then we measure the amount of time with this
@ActivityDuration
if {VW_EVT_AGENT_ACTIVITY.AA_TYPE} in [3,4] and
Previous ({VW_EVT_AGENT_ACTIVITY.AA_TYPE}) IN [5] and
NEXT ({VW_EVT_AGENT_ACTIVITY.AA_TYPE}) IN [5]then
totext ({VW_EVT_AGENT_ACTIVITY.AA_ACTIVITY})+(" "

+RISecondsToHMS({VW_EVT_AGENT_ACTIVITY.AA_CALL_DURATION})
else
""
Then we check that they went back into AfterCallWork
@CallWork2
//This is the current state
if {VW_EVT_AGENT_ACTIVITY.AA_TYPE} in [3,4] and
Previous ({VW_EVT_AGENT_ACTIVITY.AA_TYPE}) IN [5] and
NEXT ({VW_EVT_AGENT_ACTIVITY.AA_TYPE}) IN [5]then
totext (Next({VW_EVT_AGENT_ACTIVITY.AA_ACTIVITY})+(" "

+RISecondsToHMS(Next({VW_EVT_AGENT_ACTIVITY.AA_CALL_DURATION})))
else
""
Then total the combined time that should have been recorded as actually spent in AfterCallWork
WhilePrintingRecords;
if {VW_EVT_AGENT_ACTIVITY.AA_TYPE} in [3,4] and
Previous ({VW_EVT_AGENT_ACTIVITY.AA_TYPE}) IN [5] and
NEXT ({VW_EVT_AGENT_ACTIVITY.AA_TYPE}) IN [5]
Then
RISecondsToHMS (next({VW_EVT_AGENT_ACTIVITY.AA_CALL_DURATION})+previous({VW_EVT_AGENT_ACTIVITY.AA_CALL_DURATION}))
else
""
They caught on to how we are capturing this as well and started switching from AfterCallWork to available to unavailable back to AfterCallWork which is why I need to compare two records back, because as itis now it looks backwards 1 record for an AfterCallWork when it was 2 back.
Does this make sense? Sorry about the length of this post but I figured it may make more sense if you understand why I am trying to do it.
Thanks again