March 1, 201312 yr I would like for one of my databases to track the user's active or inactive status in FileMaker. My thought is that the tracking file needs to have a script which has a variable that gets updated with a "last action" timestamp sent from any of the open files, and an onTimer script that compares the current timestamp with the "last action" timestamp. When the difference in time exceeds a certain amount of time, the status is changed to "away", and when the user returns, the status is changed back to "online." I'm thinking that the simplest way to do this would be to have a script called "log activity" in the tracking file, one that any file that is open could call.. I'd have to attach the script call to all major script activities in all files. The onTimer script in the tracking file will look for a difference between "last activity" and "current timestamp", and if it exceeds a certain amount, the status is changed to "away", and when a new activity updates the "last activity"... the status will be changed back to "online." Am I right in my thinking here? Is this a good approach?? I don't think any parameters are even needed unless I wanted to do logging.. agree? thanks
March 1, 201312 yr I presume you're hosting with FileMaker Server. If so, you should consider running your status-checking script as a scheduled server-side script, maybe every 5 minutes or every minute. If you want status update to refresh faster than that, perhaps you can include a "Refresh Now" button on your layout showing user activity statuses to re-run the status-checking script, or as a sub-script in an OnLayoutEnter trigger.
March 1, 201312 yr How would a server-side script know which users are logged in? The only thing that comes to mind is to use a server-side plugin that executes a shell command involving fmsadmin LIST.
March 2, 201312 yr My understanding of djbeta's description of his plan was that each script being used by end-users would set some timestamp flag field to indicate activity (not whether or not users are simply logged-in, but active), like a severely reduced FMBench. I read the OnTimer trigger as a routine running for a supervisor on a separate client that checks those timestamp flag fields, which would be just as accessible to a server-side script. Do you have a different interpretation?
March 2, 201312 yr Does this logging need to be live? If not, look at FM Server's Access Log. BTW I'm not sure what you want to achieve with this user logging. What exactly is an active or inactive user? Some files will be opened hidden when the data is called through a relationship, and the user could be adding records even though a window is not open. Doe this count as activity? What is to be achieved by recording a user as away or online? Can you explain what you want to achieve? Perhaps an audit trail might be better. Call me old fashion, but anything that requires a script to repeatedly run in the background on a client's machine is a FAIL in my book. Think of the processing overhead, and the additional complexity it will create as it interacts with other scripts.
March 31, 201312 yr A possibly more simple method is to have a file with a list of your users and a number field that is set to 1 with every script or if this is for mobile users use a separate window that runs an on timer and sets field to 1. Run server side scheduled script every x minutes to set field back to 0. On server second pass if field = 0 set user status away, else online. This would be easier for other files to reference for status check.
Create an account or sign in to comment