For reference, here are two little handy agents you can use in any db to update a value of a field in all selected docs. The first agent prompts you for the field name, the new value, and if you want to replace the current value or append to it. If you’ve run it before, it doesn’t prompt you again, but just acts on the selected docs using the values you already supplied.
The second agent allows you to clear out the values you set in the first agent so you can start afresh.
First agent:
Name: SetField
Runtime Trigger: On Event, Action menu selection
Target: All selected documents
Formula:
@If(@Environment(“fld”)=“”;@SetEnvironment(“fld”;@Prompt([OkCancelEdit]; “Field”; “Enter the name of a field”; “”));“”);
@if(@Environment(“val”)=“”;@SetEnvironment(“val”;@Prompt([OkCancelEdit]; “Value”; “Enter the new value”; “”));“”);
@If(@Environment(“action”)=“”;@SetEnvironment(“action”;@Prompt([OkCancelList]; “Action”; “Enter”; “Replace”;“Replace”:“Append”));“”);
fld:=@Environment(“fld”);
val:=@Environment(“val”);
action:=@Environment(“action”);
@If(action=“Replace”;
@SetField(fld;val);
@SetField(fld;@GetField(fld) : val)
);
SELECT @All
Second agent:
Name: ResetSetField
Runtime Trigger: On Event, Action menu selection
Target: All selected documents
Formula:
@SetEnvironment(“fld”;“”);
@SetEnvironment(“val”;“”);
@SetEnvironment(“action”;“”);
SELECT @All