Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Automated calculation


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

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 7281 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.