I'm interested in creating an access log that shows the login, the logout, and the duration of each session. Login, I got. But this requires that at logout, I find the latest login record for the current user and then update the logout date/time and calculate the duration.
I've not been able to really figure out how to fetch a record and update values in a process or rule. In my case, I need to FIND the log record where it belongs to the current user AND is has the latest login timestamp.
Any quick thoughts/guidance?
Access Log with Login, Logout, and Duration
Something like will find the latest entry in a log:
FIND UserLog WHERE UserLog.LoginName=LoggedInRegularUser.LoginName ORDER BY UserLog.LogTime DESC TAKE BEST 1
If it helps at all, here is a rule that I sometimes as a Logout Notification in the section 'When Logout Notification is Received"
LoggedInRegularUser.LastLogoutTime=CURRENT_TIMESTAMP
LoggedInRegularUser.LastLogoutTimeout=LogoutNotification.IsTimeout
LoggedInRegularUser.LastLoginDuration=LoggedInRegularUser.LastLogoutTime-LoggedInRegularUser.LastLoginTime
One other idea would be to collect the duration info in the RegularUser instance with the above rule, then add a RegularUser rule to CREATE an appropriate log record using the duration info that is calculated above.
Tom
FIND UserLog WHERE UserLog.LoginName=LoggedInRegularUser.LoginName ORDER BY UserLog.LogTime DESC TAKE BEST 1
If it helps at all, here is a rule that I sometimes as a Logout Notification in the section 'When Logout Notification is Received"
LoggedInRegularUser.LastLogoutTime=CURRENT_TIMESTAMP
LoggedInRegularUser.LastLogoutTimeout=LogoutNotification.IsTimeout
LoggedInRegularUser.LastLoginDuration=LoggedInRegularUser.LastLogoutTime-LoggedInRegularUser.LastLoginTime
One other idea would be to collect the duration info in the RegularUser instance with the above rule, then add a RegularUser rule to CREATE an appropriate log record using the duration info that is calculated above.
Tom