I would like to run a script that sets a "emailed" field to "1" on every record in a found set on a list layout.
This will be run once a PDF is emailed with all the listed records.
Any help would be greatly appreciated.
There is a Replace, although, I prefer a scripted Loop to Set Field
Go to Record (first)LoopSet Field (marked; 1)Exit Loop If ( Get ( FoundCount ) = Get ( RecordNumber ) //stop if this is the last record )Go to Record (next) // note! I don't use the "Last" option hereEnd Loop
Go to Record (first)
Set Field (marked; 1)
Exit Loop If ( Get ( FoundCount ) = Get ( RecordNumber ) //stop if this is the last record )
Go to Record (next) // note! I don't use the "Last" option here
dito - but there is one small problem with the loop: Replace shows a nativ progress bar, the loop-method won't have that without plugins/workarounds. With bigger found sets, it's sometimes really good to see progression...
Emailed or not (autoenter 0 on record creation) seems quite limited to me.
I need to know WHEN I emailed the client, so I expect a LastEmailedDate (or timestamp) field on the client record.
Just knowing that I emailed him once (maybe 3 years ago) does not give much info IMHO.
Your email script sets this value as soon as the email goes out, no need to replace or loop.Then you work around this info.
True! In that case, I may switch to list view, loop and then switch back. Or you can put something in the "loop" that updates showing a "progress". This would have to be in the header/footer to show for all records in the found set. Or if it really is a larger found set, I don't want anything to slow the progress, so just tell the users it will take a while and show a "done" dialog at the end.
For stand alone solution, "Replace field contents" may be enough for the purpose.
For shared solution, need attention for records locked by others.
"For stand alone solution, "Replace field contents" may be enough for the purpose.
For shared solution, need attention for records locked by others."
- the looping script will have the same weakness (but you can check for an error and report back to the user, complete with a record identifier).
Beverly - why do you prefer this:
...to using the 'Exit after last' option?
Alan, I monitor the FMServer logs for clients and the
Go to Record ( Next ; Exit after last )
will produce an error in the server logs! I believe when you are ON the last record, there is NO "next", so the error is produced and then the loop exits. But I cannot verify that. Others have posted the work-around I have been using. My clients prefer no errors.
Thanks for the clarification, Beverly; sounds like a false-positive bug in the FM reporting to me. I have never (knowingly) had an operational problem with the 'Exit after last'. Meantime I think I'll migrate to your method.
Bev is correct in her description. Exit after last works perfectly well. But the server logs DO report it as an error. You can learn to ignore that error; or script to avoid it.
Retrieving data ...