9 Replies Latest reply on Jul 9, 2016 9:55 PM by BruceRobertson

    Marking whole found set

    lukeingram

      Hi,

       

      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.

       

      Thanks

      Luke

        • 1. Re: Marking whole found set
          beverly

          There is a Replace, although, I prefer a scripted Loop to Set Field

           

          Go to Record (first)

          Loop

          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

          End Loop

           

          beverly

          • 2. Re: Marking whole found set
            Markus Schneider

            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...

            • 3. Re: Marking whole found set
              siplus

              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.

              • 4. Re: Marking whole found set
                beverly

                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.

                 

                beverly

                • 5. Re: Marking whole found set
                  user19752

                  For stand alone solution, "Replace field contents" may be enough for the purpose.

                  For shared solution, need attention for records locked by others.

                  • 6. Re: Marking whole found set
                    alangodfrey

                    "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:

                    Exit Loop If ( Get ( FoundCount ) = Get ( RecordNumber ) //stop if this is the last record )

                    ...to using the 'Exit after last' option?

                    • 7. Re: Marking whole found set
                      beverly

                      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.

                       

                      beverly

                      2 of 2 people found this helpful
                      • 8. Re: Marking whole found set
                        alangodfrey

                        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.

                        Thanks.

                        • 9. Re: Marking whole found set
                          BruceRobertson

                          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.