I've set up a table to show who is logged in and when they log out. I created a script named "Autoexec" to run when someone logs in, it enters a record into a table I have called "Logins", this table has four columns in it (PK_LOGIN_ID, USERNAME, LOGGED_IN, LOGGED_OUT) when the script runs it enters USERNAME = user_name() and LOGGED_IN = Now(). What I would like it to do after it enters the record is set a variable called "varLOGIN_ID" to be set to the entered record for the PK_LOGIN_ID.
I then would like to set a script for "CanDatabaseClose" to set the LOGGED_OUT using the variable it created upon login. The problem I am having is:
(1) Setting the variable to the logged in user.
(2) Setting the CanDatabaseClose Script to update the LoggedOut field using the varibale as the record identifier.
Heres the script in my AutoExec that I have running after the record gets entered (by the way I used action scripting for "Xbasic Enter new record" to enter the record), it is not setting the variable and is not running the query that I want, I am not sure what is wrong here.
As for the CanDatabaseClose script, I have not set it up since I am not sure how to?
I then would like to set a script for "CanDatabaseClose" to set the LOGGED_OUT using the variable it created upon login. The problem I am having is:
(1) Setting the variable to the logged in user.
(2) Setting the CanDatabaseClose Script to update the LoggedOut field using the varibale as the record identifier.
Heres the script in my AutoExec that I have running after the record gets entered (by the way I used action scripting for "Xbasic Enter new record" to enter the record), it is not setting the variable and is not running the query that I want, I am not sure what is wrong here.
Code:
dim tbl as P dim qry as P dim run as P tbl = table.open("LOGINS") query.filter = "USERNAME = USER_NAME()" query.order = "invert(pk_login_id)" qry = tbl.query_create() run = qry.records_get() dim LOGIN_ID as N tbl.fetch_first() while .not. tbl.fetch_eof() LOGIN_ID = tbl.pk_login_id tbl.fetch_next() end while run.close() tbl.query_detach() tbl.close() DIM varLOGIN_ID AS N varLOGIN_ID = LOGIN_ID
Comment