September 10, 20205 yr I have a field named "Databases" with the following values: "CORD", "SDHS", "Y Ballet". This field is displayed as a checkbox set. I recently learned that "CORD" should have been "DSA", so I naively changed "CORD" to "DSA" in the value list but then none of the records that were checked for "CORD" were checked for "DSA", which reminded me that the values in the value list are the values of the field Databases and not labels for checkboxes. I revised the value list to again include "CORD" and its checkbox is again checked for all the records for which it was originally checked. I wrote a script, shown in one of the attachments, to insert "DSA" into the Databases field for each of the records that contains "CORD" in that field. When I run the script I get an error message saying "Databases" is defined to contain only specific values, and that I must enter a valid value. How can DSA not be a valid value when it is included in the value list for the field? How can I accomplish what I want to do? Does programming scripts in FileMaker ever get easier? I don't write many scripts, but when I do I find it surprisingly difficult to accomplish what I think would be the simplest of tasks. Thanks in advance for your help, John Link Edited September 11, 20205 yr by John Link
September 11, 20205 yr If you want to know what's really happening, place another instance of the field on the layout and format it as an edit box. Then you will see that if the field has say CORD and SDHS checked, it contains: CORD SDHS Now, your script inserts the text "DSA" at the default insertion point, which is at the end of the field's data, resulting in: CORD SDHSDSA and "SDHSDSA" is not in your value list. Based on your description, I would expect to see an entirely different action: Set Field [ YourTable::Databases; Substitute ( YourTable::Databases ; "CORD" ; "DSA" ) ] Note also that your script is missing a Loop section. it will modify the first record (or at least try), move to the next record and stop. Edited September 11, 20205 yr by comment
Create an account or sign in to comment