Bekah Posted September 26, 2004 Posted September 26, 2004 Not sure where this goes. sorry if in wrong place. I attached a script to a button for closing the file. It looks like this, set error capture on Allow user abort Off Show custom dialog: "Session Termination" ... and it has 3 choices. Default = Terminate, button 2 = Relogin and button 3 = Cancel If Get ( LastMessageChoice ) = 3 Halt Else If Get(LastMessageChoice) = 2 Re Login Halt Endif Endif Exit Application Two problems im having ... 1) if they enter their stuff wrong it doesn't tell them. It just stays on the previous persons login but they don't notice that and they start working under the wrong person. I would like it to tell them they blew it but I don't know where or had that message. 2) If they are logging out, it ususally means they are clocking out also. I would like to ask if they want to clock out. For the clock out, I have timecard table with multiple date/time in out records for each person. My staff table knows the person and it also contains their AccountName which matches the login account names. I can't add a fourth button to the dialog. about clocking out. Can someone help me please? the logout button is on every layout so I don't know how to grab their logout and create a record in timecards inserting the date/time. do I need a relationship from every single table to timecards to do this? Bekah
Bekah Posted September 26, 2004 Author Posted September 26, 2004 Oh, see, people move around and use each others computers. so we need to be able to re-login when this happens. I hope that explains why I have 3 options when leaving the file. And I had to add the cancel because sometimes they didn't mean to - and they don't like having to enter everthing again.
RalphL Posted September 26, 2004 Posted September 26, 2004 Take a look at the scripts in the set of files I posted under the "Separation Model and Account Management" in the Separation Model Forum. http://www.fmforums.com/threads/showflat.php?Cat=0&Number=120837&an=0&page=0#120837
Bekah Posted September 26, 2004 Author Posted September 26, 2004 Thank you for helping Ralph. I don't have seperation my tables are all in one file and I admit I got totally lost in the 50+ long relogin script. I am not that smart on FM yet and I have no idea what it all your scripts do but I will surely work on it until I figure it out. I think I need to test for error and if so, insert another if (or even another script) in the script. I will work on this. Something else strange in your relogin . You have ifs under (inside?) ifs. I think this is what I need to ask people about clocking out. Then I wouldn't need more buttons on custom dialog than 3. I am still at aloss on, if they want to clock out how to create a new timecard Out record when my layouts (tables) aren't all connected to timecards. I guess I'll Halt and make them click the 'timecards' button and switches to timecard form and just create their own record. I guess this was too difficult to ask how. Its a shame too. I know I can get current date, current time and their account so the computer knows everything it needs to create their timeout record. But I can't pass that through the air to Staff table to get their StaffCode and then on to timecards and I don't want to connect every single table to timecards so I can go to the related. Well. i feel a bit lost. But you have helped me and I appreciate it a lot.
Fenton Posted September 26, 2004 Posted September 26, 2004 Without getting into the whole re-login thing, I can quickly say that if the account names match your Staff names, you should have no trouble accessing or creating a "time card" record. You can always get the account name, in any table, with Get (AccountName). It is also one of the choices for auto-enter fields; at the bottom, after the Dates, is Account Name; convenient for new records. Get(AccountName) can also be created as an UNSTORED calculation field, to use on the Left side of a relationship, either TO or IN the Time Card table. You would want to either sort the relationship descending by date & time (or TimeStamp), or Go to Record [ Last ] after arriving, for their latest entry.
Fenton Posted September 26, 2004 Posted September 26, 2004 Getting into the whole re-login thing. There is an error returned if a re-login fails, which you can access with Get (LastError), ? 0 may be sufficient, or you can get more particular. Or, conversely, no error or 0 is returned for a successful re-login. If you put Set Error Capture ["On"] right before Re-login, then they'll only get 1 chance, one dialog, which seems a little harsh. It's fine to let them have the dialog to try again, because cancelling the login dialog is considered an error (as is 5 tries), so you can close the file at that point. As far as asking if they also want to clock out, just nest another dialog. I imagine you want to ask BEFORE re-login or terminate; because in the 1st case, you need to know who they are before someone else logs in, or before they leave. Another addition could be a Log Out button, or choice, which would be an alternative or addition to Terminate. You could create a very low access account, then re-login with that. Maybe it would only show a pretty much blank Login window. So someone could log out, without having to close the files, which take a while to open again. You may want them to Terminate at the end of the day though.
Bekah Posted September 27, 2004 Author Posted September 27, 2004 Ok i think I have it! error works but i had to use another global field because login didn't keep it if it was wrong so I couldn't check it. It kept saying it was the previous person. So I put the Account Name in global and checked it there. if the same name, I knew they did something wrong and message tells them it didn't work and do it again. Timecards. added a global in timecards to hold the account name. related that to another staff occurance on account name. I couldn't figure how else to get that staff code to insert into the new timecard record when all I had in timecards was their account name. Then I use this part of script freeze the window go to tmecards new record request set WorkDate to Get Current Date Set WorkTime to Get Current Time Set Type Out (i'll add an In part in the script also) Set global get Account Name commit the record set staffcode to Employee::StaffCode this is another script with sub-If. So if they choose exit or relogin it asks the question. If yes, this runs. If no, it just proceeds. Pretty clever huh!? I didn't need to be related to everything just needed a new table occurance to employee to keep this one person separate while it worked. and i needed to be sure the scrpt fired on the right layout (timecards). it works and creates an out record. I'll add an in sub-if. I think I like those. Unless you all see any problems I don't see, you have helped me fix it. thank you SO VERY MUCH FOR HELPING!!!
Recommended Posts
This topic is 7365 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 accountSign in
Already have an account? Sign in here.
Sign In Now