September 24, 200421 yr I designed an employee database that keeps track of sick days. After the completion of each month, all employees receive an additional 1.25 days. I have a number field called (days available) that contains all of the employees accumulated days. I want to automate this process and add 1.25 days to all of the employees (days available) based on the the P.C.'s internal clock. Can anyone help me with this process? Thank You Steve
September 24, 200421 yr Hi, Steve. Maybe you could make a script scheduled to run on opening: If ( "Day ( Status ( CurrentDate ) ) = 1 " ) Show All Records Go to Layout ( "some layout that shows [days available]" ) Replace ( days available , days available + 1.5 ) End If If you're running FM 7, replace "Status ( CurrentDate )" with "Get ( CurrentDate )" (and update your profile). Jerry
September 24, 200421 yr Oh yeah, you would also need to add some sort of flag field. The way i have it above, every time you open the DB that day, all employees will get 1.5 more sick days. Amended script: If ( "Day ( Status ( CurrentDate ) ) = 1" ) If ( "Flag = 1" ) Show All Records Go to Layout ( "some layout that shows [days available]" ) Replace ( days available , days available + 1.5 ) Set Field ( flag , 0 ) End If Else Set Field ( flag , 1 ) End If Now the flag is reset to 1 on every day that is not the first of the month, and on that first day, the Replace is only run if it has not already been run today. HTH. Jerry
September 24, 200421 yr Author Thank you very much for your help! Would this still work if the database is used on a LAN setting? I will also my profile. I am currently using FileMaker 4.1 Steve
September 24, 200421 yr The only thing being on a LAN would change is the way global fields behave, and since Flag should be a global field, this is relevant. Values in global fields are stored locally, not on the server; thus my workstation may show Flag=0 while yours shows Flag=1. There are a few good posts on FM Forums about how to deal with globals across a network, which i don't have time to search for at the moment, but you should be able to find them. The basic strategy is to create another file with exactly one record, which then acts as a "global" storage file but with the data the same for all users. J
Create an account or sign in to comment