October 19, 200718 yr 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?
October 19, 200718 yr 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 October 19, 200718 yr by Guest Added sentence
October 19, 200718 yr Author 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.
October 19, 200718 yr 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 October 19, 200718 yr by Guest
October 19, 200718 yr Author Fenton - thanks, that did it. Thanks also to Laretta, even though I was going down a different path.
October 19, 200718 yr I'm glad it worked out for you. Yeah, "If I define a new "published" boolean" threw me into thinking you had a boolean field but Fenton saw through it. :wink2:
October 19, 200718 yr Author Yeah - my fault. I hit a wall when trying to implement the calculation on a Boolean and changed to a text value list when I realized I needed 3 values anyway.
Create an account or sign in to comment