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.

Checkbox that should be global

Featured Replies

Hi

Not sure this is the right category...

what I want is a checkbox field for each record in a contact table, but it should act like a global field, only for the user, who checks it.

The goal is that a user could find a list of records, then mark some of the records and then run a script that e.g. prints the selected only.

The problem is, that if it is a standard checkbox, another user could check or uncheck this box, before the first user has been able to run the print script, which makes the wanted set of records unconsistent.

Every user has their own interface file local on their computer. The datafile is located on a server.

Any suggestion to how this scenario could be accomplised ?

The checkbox that actually displays could be a calculated field, something like:

FilterValues( checkboxIDs ; userID ) = userID & ¶

Use this calc field as a button, and when a user clicks, it could add or remove his user ID to a text field (checkboxIDs).

Note: this won't avoid record locking issues, which I think are unavoidable in this scenario.

I don't see why there would be record locking issues, if the text field is a global.

Here's a multi-user friendly demo for marking records. Credit to Matt Petrowsky for the addremove calc.

If you want to allow the user to mark records over the course of a few days (quitting FM), then write the global field to a field in the user table, and restore it in an Open Script.

MarkRecordsDemo.zip

Ah, yes. I was thinking of adding the user ID to a field in each record. I've seen that technique and it was the one that popped into my head. It does make more sense to add record IDs to a global instead.

  • 2 years later...

Here's a multi-user friendly demo for marking records. Credit to Matt Petrowsky for the addremove calc.

1213301337-MarkRecordsDemo.zip (6K)

This is just what I have been looking for. The demo does exactly what I wanted.

The problem is mine acted funny. I have 20 records that I want to choose only 4 or less to print at one time in a special form. It seemed to work perfectly but then I was testing it and clicking different checkboxes and suddenly some of the X marks disappeared from some I had already marked. Then others would pop in when I was clicking different records. So I took the demo program MarkRecordsDemo.zip and added a dozen more records and started clicking on different boxes and his does the same thing. That's not going to work very well and there is no way I can figure what is happening. Any help would be very much appreciated. :huh:

  • Author

This is indeed an old post and I have since done many implementations to solve this challange....

My favorite is to have a global text field in my system table (the table in the data file, which hold general data for value lists, defaults etc.).

Lets say that we want the checkbox on the customer.

Then I add a relationship between customer and the global text field in SYS we call "_CustomerCheckBox_g" and the Customer_PrimaryKey_n. The relation is true if the customer pk is in the global field.

I then add a checkbox field to the customer table with this simple calc: If ( IsValid ( Customer::System_Cust_Checkbox ) ; 1 ; "" )

Based on the value in the calc field, you can show a checkbox or graphic or conditional formatting as you please.

Don't give access to the field itself, but make it a button, which adds or remove the current Customer_pk from the global field. When user logout, the global field is cleared and it is unique for each user of the system.

Check Briandunning.com for a custom function AddOrRemoveValueListItem (or something like that) That function make the implementation of this feature very easy.

This is indeed an old post and I have since done many implementations to solve this challange....

My favorite is to have a global text field in my system table (the table in the data file, which hold general data for value lists, defaults etc.).

Lets say that we want the checkbox on the customer.

Then I add a relationship between customer and the global text field in SYS we call "_CustomerCheckBox_g" and the Customer_PrimaryKey_n. The relation is true if the customer pk is in the global field.

I then add a checkbox field to the customer table with this simple calc: If ( IsValid ( Customer::System_Cust_Checkbox ) ; 1 ; "" )

Based on the value in the calc field, you can show a checkbox or graphic or conditional formatting as you please.

Don't give access to the field itself, but make it a button, which adds or remove the current Customer_pk from the global field. When user logout, the global field is cleared and it is unique for each user of the system.

Check Briandunning.com for a custom function AddOrRemoveValueListItem (or something like that) That function make the implementation of this feature very easy.

Some how I knew it wasn't going to be just a simple change to what I have.

Thanks Claus L, I will see if I can figure this out.

If ( IsValid ( Customer::System_Cust_Checkbox ) ; 1 ; "" )

IsValid is not a good choice of function here. Probably IsEmpty would be better.

IsValid is used to identify data mis-match, invalid values (such as 30 Feb in a date field) or missing fields. IsEmpty is used to identify whether a field contains a value.

  • Author

IsValid is not a good choice of function here. Probably IsEmpty would be better.

IsValid is used to identify data mis-match, invalid values (such as 30 Feb in a date field) or missing fields. IsEmpty is used to identify whether a field contains a value.

Yeah.... my bad.... I don't actually use IsValid, but it just seems easier to explain that way. Sorry for misleading.....

So I've created a sample file from FMstarter solution. Look at the checkbox field. There are also 2 custom functions, that makes this very simple....

....I couldn't see the file, so I try again......

CheckBoxGlobal.fp7.zip

Yeah.... my bad.... I don't actually use IsValid, but it just seems easier to explain that way. Sorry for misleading.....

So I've created a sample file from FMstarter solution. Look at the checkbox field. There are also 2 custom functions, that makes this very simple....

....I couldn't see the file, so I try again......

Thanks for the help, I will see if I can get it to work with my DB.

  • 5 months later...

Here's a multi-user friendly demo for marking records. Credit to Matt Petrowsky for the addremove calc.

If you want to allow the user to mark records over the course of a few days (quitting FM), then write the global field to a field in the user table, and restore it in an Open Script.

Is there a select all button or a deselect all button sample I could take a look at?

Updated demo with Mark All and Clear All.

clear all works great. the mark all how do we write the script so it only marks the records currently being viewed?

Take out the Show All records before the loop, and I'd change the button to Mark Found.

However, if you have marked some records, then did a find and marked some more, there are potentially records not in the found set that are marked.

How do you want to handle that? The Show Marked will establish a found set of all marked.

  • 10 months later...

Here's a multi-user friendly demo for marking records. Credit to Matt Petrowsky for the addremove calc.

If you want to allow the user to mark records over the course of a few days (quitting FM), then write the global field to a field in the user table, and restore it in an Open Script.

I just came across this post, and this demo is something I've tried to implement in a database before. Can you explain how the toggle works, I understand how to add to a list, but couldn't figure out how to deselect (so I just implemented a clear all). I'd like to be able to individually deselect items however.

The toggle is a fancy substitute. If it finds the value in the global, it substitutes it out, otherwise it appends it.

Clear All will empty the global. You'll lose all marks.

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.