Jump to content
Server Maintenance This Week. ×

Log Files


This topic is 7118 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Using FMPro 7.2, I need to create a table that will log in AND OUT all of my 38 users each time they access the database. My database has 9 tables with a main menu that directs my users to their area.

I have created a table (tblLogFile) and fields LogID, User Name (calc - Get(Account Name)), LoginTimeStamp, LogIPAddress (calc - Get(SystemIPAddress), LogPrivileges (calc- Get(PrivilegeSetName), LogoffDate (date field), LogoffTime (time field) and LogoffTimestamp that puts the date and time in the logoff date and time field. A script to open a new record in tblLogFile works great and the user name and all information is generated like it should.

My problem is the logging out part. I know I need to create a script that will find the user's current LogID and then timestamp the logout date and time but my woefully inadequate scripting abilities has risen it's ugly face and I NEED the help of someone a bit more skilled. Help??

Sandie

Link to comment
Share on other sites

The Close button for logging out could have an attached script with a parameter set equal to LogID. With that parameter, then the script would be able to Set Field timestamp and logout date correctly.

Link to comment
Share on other sites

Thank you kindly for answering quickly. Would this solution require an established relationship between tblLogFile and the other 9 tables in my database? tblLogFile is a rogue table that stands alone and is for keeping track of who logs into the database and what time they log out. I'm sure this is a simple solution but I'm not understanding your answer.

Could you offer further help?

Link to comment
Share on other sites

The same script could be attached to the same Close button on the 9 layouts. The relationship could be set up in any number of different ways. One way: find a record in tbILogFile with the same LogID as the script parameter but no logout time (presumably there would be only one such record). So do a find in in the script for a concatenated field of LogID and logout time in the tbILogFile; use = Get (ScriptParameter) on the right side of the find.

Link to comment
Share on other sites

Here's a better and much simpler way. Every time a user logs in or logs out, create a new record in the tbILogFile, specify the user ID, and set the timestamp. If it's not clear from the timestamp whether it's in or out, that could also be specified in a one-digit code. You could then view the records in Table View. Be sure to regularly purge this file.

For my own programs, I usually add four auto-entered fields, placed in the lower right corner of a layout, like this:

Created by: zc_createdName

on: zc_createdDate

Updated by: zc_modifiedName

on: zc_modifiedDate

(none changeable by user).

Link to comment
Share on other sites

Here is a thought: is a user has an odd number of log records, they are IN. An even number of records means they are OUT. (Unless some reason prevented a log record from being created.)

Link to comment
Share on other sites

Thanks for responding - it's appreciated.

I did come up with a solution - not pretty for sure but it works. I created a "logout" script that executes when the Exit button is hit...

Select All

Go to Field [tblLogFile:User Name]

Perform Find/Replace [Find: Get(AccountName); Search operation: Find Next: Search settings: Forward; Search Across: All records/requests: Search within:Current Field]

Go To Record/Request/Page [Last]

Go to Field [tblLogFile::Logoff Date]

Insert Current Date [] Select

Go to Field [tblLogFile::Logoff Time]

Insert Current Time [] [select]

Exit Application

Keeping an activity log of patient databases is required by HIPAA. Maybe this will assist others who need to keep patient data logs.

Again, thanks

Sandie

Link to comment
Share on other sites

Create a relationship from an unstored calculation text field of Get(AccountName) to the User Name field (I'll call it 'User'). Define the relationship to sort by Logon Date and Logon Time, both descending. The first related record becomes the most recent record according to descending Logon Date and Time. Now you can set your fields via relationship and speed up the process.

Your script will look like

Set Field [user::Logoff Date; Get(CurrentDate)]

Set Field [user::Logoff Time; Get(CurrentTime)]

Exit Application

No select, find, Go to Record, or Insert is necessary.

Link to comment
Share on other sites

This topic is 7118 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.