Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Automated calculation

Featured Replies

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

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

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

  • 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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.