AnsweredAssumed Answered

Script to insert text into field on multiple records in found set

Question asked by spoutnik on May 14, 2018
Latest reply on May 15, 2018 by ThierryGuemboura

Hello everyone,


I am new to FileMaker (I am on 16) and I have been trying to write a script that would, for all records in a found set, insert a line of text (to be specified by the user) at the beginning of existing data in a specific field.


In fact I have been trying to do exactly what was suggested by SteveMartino in response to this post:


This can also be scripted, where you pop up a dialog, type the sentence and it performs the replace field contents calculation in the correct field


I have tried to write a script with my little experience of coding/scripting with little success so far:

  1. Go to Record/Request/Page [First]
  2. Loop
  3. Replace Field Contents [With Dialog: On; Database::Field [Get ( CurrentDate ) & ¶ & "insert text" & "¶" & Publishers::Submissions]
  4. Go to Record/Request/Page [Next; Exit after last: On]


When I run this, my first problem is that it ignores the line I specified in the Replace Field Contents and asks me to enter it again. If I do this…

The second problem is an error window that pops up saying "(x) records couldn’t be modified because they were in use by other users or your privileges do not allow you to change them". I don’t understand how this is possible as right now I am the only one using our database and I have granted ‘full access privileges’ from the script workspace.


And I didn’t even manage to fit it a way to replace the "insert text" bit in the above by something like:

Show Custom Dialog ["Type text to insert"; Database::Field]


Presumably there are a lot of things I am doing wrong here so I would appreciate any help I can have!


Thank you very much.