tom24569 Posted October 19, 2007 Share Posted October 19, 2007 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 More sharing options...
LaRetta Posted October 19, 2007 Share Posted October 19, 2007 (edited) 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, 2007 by Guest Added sentence Link to comment Share on other sites More sharing options...
tom24569 Posted October 19, 2007 Author Share Posted October 19, 2007 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 More sharing options...
Fenton Posted October 19, 2007 Share Posted October 19, 2007 (edited) 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, 2007 by Guest Link to comment Share on other sites More sharing options...
tom24569 Posted October 19, 2007 Author Share Posted October 19, 2007 Fenton - thanks, that did it. Thanks also to Laretta, even though I was going down a different path. Link to comment Share on other sites More sharing options...
LaRetta Posted October 19, 2007 Share Posted October 19, 2007 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: Link to comment Share on other sites More sharing options...
tom24569 Posted October 19, 2007 Author Share Posted October 19, 2007 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now