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

global change


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

Recommended Posts

I'm looking for a way to define a new field with limited options and then set the value for that field on all records or a specific group of records. For example, I have imported a bunch of records into a database that is keeping track of many short documents. I'm going to add a checkbox field to each record indicate whether or not the document has been published. If I define a new "published" boolean, how do I set all of the records, or a select group of records, to that value? I don't want "published" to be the default.

In other words, is there a way to do a global setting of the value in a certain field?

Link to comment
Share on other sites

Welcome to FM Forums!

If you want to set that field with boolean 1, you need a value list with only a 1 value attached to a checkbox. Resize the checkbox to width same as height, ie, if 18 px high, make width 18 px. This will make the 1 disappear. Type your label 'Published' next to it.

Script would be similar to (untested):)

# First make sure it's not be accidently fired on all records in table

If [ Get ( FoundCount ) = Get ( TotalRecordCount ) ]

Show Custom Dialog [ No ; Yes ; "Are you sure you want to set ALL records to published?" ]

If [ Get ( LastMessageChoice ) = 1

Halt Script

End If

End If

Replace Field Contents [ Published ; 1 ]

If you want the option of setting a field (maybe called status) with various values, you can instead use a global field to accept User input from Custom Dialog, and then replace the value through the found set by replacing with 'calculated value' and specifying that global field after the value has been accepted. Note also that Replace Field Contents [ ] isn't particularly safe in multi-user (it doesn't throw a record-lock error) so you might want to use Set Field [ ] instead. The jury is widely torn on that subject.

LaRetta

Edited by Guest
Added sentence
Link to comment
Share on other sites

Being a novice, I was confused by your answer. In my database of about 1200 records, I've set up a radio button variable with 3 text values: Collected, Submitted, and Published. What I'd like to do is change the values for the radio buttons on all records to "Published". I only want to do this once, for the records I've imported. From then on, I want to be able to set the status of each document by hand. So the "global" change is really only a convenience on first launching the database, which starts out with a listing of "Published" pieces. I hope this makes sense. As a one-shot action, I don't really care about a "fail-safe" script. I just want to do this once and then revert to setting the radio buttons by hand. Hopefully that's easier to do.

Link to comment
Share on other sites

LaRetta was telling you how to safely Replace a Boolean value (1). But your value is not Boolean. It is text. Also, it sounds like you only want to do this once. So maybe you should just do it manually.

In either case the step is Replace. I advise you to read about it in the FileMaker Help. Because it is a powerful step, operating on the current field of all records of the found set.

To do it manually, after the Import (which produces a found set of the imported records).* Click the "Published" radio button (any record). Immediately go up to the Records menu,** and choose Replace Field Contents. It will have as the default, Replace with "Published". Click Replace.

* Backup the database, with Save a Copy As [ Copy ]. Replace is NOT "undoable."

** If you have clicked out of the field, Replace will be greyed out.

Edited by Guest
Link to comment
Share on other sites

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