Skip 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.

How to get the old global field value when we reopen the database

Featured Replies

In FM6, I have a database file that has two global variables. I set these two to 1 when two different types of invoices are printed. Later when a user wants to move to next billing period, the script checks to make sure that the invoices are printed (checks if these two globals are set to 1) and then moves to the next billing period and sets the two globals to 1.

However, when the user prints the invoices on one day and then tries to move to next billing period on the next day, the script finds that invoice has not been printed (since the global values are lost).

Is there any workaround to retain the global value like copy this value to another database when the file closes and when it is reopened copy it back from the other database. Then, the other database should hold these values in regular non-global fields right? I have another database which contains only one record. But I am not able to figure out how the relationship should be defined between the two tables. Any ideas??

Thanks

In FM6, there are no variables, so I'm assuming that you mean global fields.

Global fields reset to the values that existed when the file was last closed in single user mode. You shouldn't rely on them from session to session.

The method to use is to have a field (not global) store these values. You can "publish" them to globals by using a set field script step in a script that runs on open (see File Options).

All that being said, I'm wondering why you don't have a field in each invoice that stores whether or not it has been printed. I call these type of fields "flags" and name them, "flag_printed" and it's just equal to 1 if it's been printed. My print script sets it.

Another way is to break it out into a different table related with the primary key of the userID/Name, allow creation of related record is obviously required to gain writing permission.

--sd

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.