1 2 Previous Next 16 Replies Latest reply on Sep 30, 2013 9:37 PM by Fred(CH)

    Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit

    DaveBartczak

      Summary

      Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit

      Product

      FileMaker Pro

      Version

      12.0v4

      Operating system version

      OS X 10.8.5

      Description of the issue

      When performing a find on a layout with a OnRecordCommit trigger and there is no record found with the current criteria, the trigger does not fire prior to the find request and limit the possible usefulness.

      Steps to reproduce the problem

      1. Configure a layout with an OnRecordCommit trigger configured to run exclusively in Find Mode. The actual content of the script is only relevant to showing an output for testing purposes.
      2. Enter Find mode.
      3. Enter search criteria which will return no record without committing the request.
      4. Hit the menu bar button "Perform Find"
      5. Error appears stipulating that there is no record matching criteria occurs instead of the script trigger.

      Expected result

      The trigger should fire prior to the check of found criteria as the trigger could very well modify the find criteria programmatically before performing the find in order to get the expected result set.

      Actual result

      The error "No records match this find criteria" appears and the trigger only gets fired upon hitting the "cancel" button.

      Exact text of any error message(s) that appear

      No records match this find criteria

      Configuration information

      The trigger is configured to fire ONLY in find mode. For testing purposes, the only thing the script does is a "Show Custom Dialog[1]

      Workaround

      No known workaround

        • 1. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
          philmodjunk

               Performing a find does not commit data to your database and thus does not trip the OnRecordCommit script trigger.

               Why would you want this to happen? I would guess that you might want a follow on script to further process any user initiated finds such as constraining the found set to omit certain records or to make sure that the records are always sorted in a particular order.

               IF so, use the OnModeChange trigger to do this "post find" processing instead of OnRecordCommit.

          • 2. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
            DaveBartczak
                 

            Performing a find does not commit data to your database and thus does not trip the OnRecordCommit script trigger.

                 

                      Why would you want this to happen? I would guess that you might want a follow on script to further process any user initiated finds such as constraining the found set to omit certain records or to make sure that the records are always sorted in a particular order.

                 

                      IF so, use the OnModeChange trigger to do this "post find" processing instead of OnRecordCommit.

                 Yes, it is to either extend the found set based on the user's find criteria in specific fields or to constrain the found set. In the situation I'm confronted with, the user wants his criteria to search in two different fields. So, prior to searching, I would wish to scan the requests in order to see if there is info in the targeted fields and duplicate the requests which have to move the criteria to a second field while keeping all the other search criteria intact within those requests.

                 I just tested with OnModeExit trigger (OnModeChange does not exist) and it has the same behaviour. You may update the issue to target both OnRecordCommit and OnModeExit triggers while in Find mode.

                 Also, "post find" processing would not work in this case as the user is not in a script, and may perform searches which trigger the "No records match this find criteria" if the trigger does not start. The process should not implicate an error dialog in any situation, except if the user would get no found set even after the trigger processes the request list.

            • 3. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
              philmodjunk

                   Sorry, I meant OnModeExit. I have used the ONModeExit triggers for this kind of "post find processing" successfully. You do have to select the correct options in order for the trigger to be tripped at the correct time. Specifically, you have to select only FInd as the mode being exited by selecting only that check box in the Script Trigger dialog box.

                   

                        Also, "post find" processing would not work in this case as the user is not in a script, and may perform searches which trigger the "No records match this find criteria" if the trigger does not start. The process should not implicate an error dialog in any situation, except if the user would get no found set even after the trigger processes the request list.

                   I'm not sure that I understand what you are saying there even after reading it several times. Do you mean that you want users to perform a find and never get that error dialog if no records are found? That isn't possible unless you set up a scripted system for the user to use when querying the database. Examples of such methods can be found in this thread: Scripted Find Examples

                   And a quick test shows that the OnModeExit trigger is still tripped when that error dialog appears and the script it performs can be set to do nothing if the found set is empty if such is needed.

                   

                        You may update the issue to target both OnRecordCommit and OnModeExit triggers while in Find mode.

                   But there IS no issue with OnRecordCommit as you do not commit records when performing a find. That only happens when a record is created or changed in Browse mode, not while in find mode.

              • 4. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                DaveBartczak
                     

                But there IS no issue with OnRecordCommit as you do not commit records when performing a find. That only happens when a record is created or changed in Browse mode, not while in find mode.

                     I would like that the focus of the issue gets back on the process of OnRecordCommit please as that was my original post. I invite you to check for yourself that OnRecordCommit does indeed fire when you commit a request while still being in find mode. You can make that commit happen by clicking in any place on the layout where there is no field under the cursor, by firing a "Commit Records/Request" script step or by navigating to a new request while the current request has been modified, and I assure you, the OnRecordCommit trigger will fire itself. Note that you must specifically say to execute the OnRecordCommit trigger in find mode in the Script Trigger dialog box.

                     Note that the spelling of OnRecordLoad, OnRecordCommit and OnRecordRevert lead to some confusion as these apply to requests while in find mode, and not records as the trigger names suggest.

                     
                          

                               Also, "post find" processing would not work in this case as the user is not in a script, and may perform searches which trigger the "No records match this find criteria" if the trigger does not start. The process should not implicate an error dialog in any situation, except if the user would get no found set even after the trigger processes the request list.

                     
                     

                          I'm not sure that I understand what you are saying there even after reading it several times. Do you mean that you want users to perform a find and never get that error dialog if no records are found? That isn't possible unless you set up a scripted system for the user to use when querying the database. Examples of such methods can be found in this thread: Scripted Find Examples

                     

                          And a quick test shows that the OnModeExit trigger is still tripped when that error dialog appears and the script it performs can be set to do nothing if the found set is empty if such is needed.

                     My users use the native FileMaker find mode outside of scripts. I want to alter their requests before they commit them to a Perform find. Right now, the problem exists only when the users enter search criteria which result in no record found. If the user would find one record with their initial request set, the triggers fire up adequately before the perform find is executed, leaving me the range to alter their requests and everything would be well. When there is no record found with a perform find in the initial request set though, the filemaker error dialog "No record match this find criteria" fires before the trigger and the two dialog options do not satisfy the intended goal at all.

                     "Modify Find" will cancel the find action and will not fire the OnRecordCommit trigger.

                     "Cancel" will fire the OnModeExit trigger and I can then force another Perform Find within the trigger script, but it will confuse my users who will not expect that a "Cancel" button actually performs the intended search.

                      

                • 5. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                  philmodjunk

                       I stand corrected and am very surprised. I would never have expected OnRecordCommit to be tripped under any circumstances while in find mode.

                  • 6. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                    DaveBartczak
                         

                    I stand corrected and am very surprised. I would never have expected OnRecordCommit to be tripped under any circumstances while in find mode.

                         That is no problem at all. I learn something new everyday too! I assure you there are no hard feelings whatsoever. We are all human and all is good. :)

                         I'm realistic here and I don't expect a sudden platform fix anytime soon either. I just wish that the problem be known and addressed by FileMaker as soon as they can process it in the request queue with their FMPro development team.

                         Well, either that or deny the OnRecord triggers while in find mode, but that would be a sad resolution as I find it really useful.

                         Thank you for the responses and attention you put in this thread. It is highly appreciated!

                    • 7. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                      philmodjunk

                           No offense taken and I try to make sure to admit my own mistakes when I plant myself face first in the middle of one.

                           You've posted to the right place to make the issue known and if/when a TS person confirms this, I'll update the Known Bugs List to include it. That has no effect on when or if FileMaker Inc. will make a change but that's a resource a lot of folks use to research a possible bug before reporting it as it's a lot easier to find a bug report in a DB than in this forum.

                      • 8. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                        DaveBartczak

                             Thank you very much again for your time.

                             I hope a TS person confirms this and I am willing to assist them in identifying the problem as much as I am able to.

                        • 9. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit

                          Dave Bartczak:

                               Thank you for the post.

                                

                               I am able to replicate the behavior described, but I am unsure of the primary goal.

                                

                               Is the goal:

                                

                               1. To trigger another script by performing a find?

                               2. To see or not see the "No records match…" error?

                               3. To commit the record/request prior to seeing the "No records match…" error?

                                

                               Any reason the process cannot be scripted so that "Set Error Capture [On]" could be used to suppress the error? Additionally, an "If" statement could be used to perform different actions based on the error.

                                

                               TSFalcon

                               FileMaker, Inc.

                          • 10. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                            philmodjunk

                                 TSFalcon,

                                 The idea that triggered this bug report is rather clever. No script is running at the time that the trigger needs to be tripped. As I understand it, Dave is trying to process the criteria entered by the user BEFORE the user initiated manual find is performed.

                                 But since Perform Find does not trip the OnRecordCommit trigger (Where clicking the layout background DOES trip this trigger), this method does not work.

                                 A fully script controlled find process is one possible workaround. Another is to use a custom menu to replace perform find with a script that does this needed "pre-find" processing of the user entered criteria when ever "perform find" is clicked in the tool bar.

                            • 11. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                              DaveBartczak

                                   TSFalcon:

                                   Thank you for your answer in reproducing the problem.

                                   The goal is indeed to commit record/request prior to seeing the "No records match..." error. In fact, the goal is to alter the user's find request before the perform find (Or constrain/extend) goes through.

                                   I have recently picked up a client solution that was created by other developers. The users are all trained to use the native FileMaker find in all modules, and there was never a reason to create a "find layout". I wish to continue upon this pattern and not have to explain to my users why there needs to be a layout switch to accommodate a "Perform Find" button, a "Constrain Found set" button, an "Extend Found Set" button, etc. as the pause/resume script will void any action performed during the pause except creating a request, duplicating a request, deleting a request or resuming the script.

                                   It seems like the commit event (prior to leaving find mode) does not occur when there are no records matching the find criteria as if raising the error message bypasses the "normal" behaviour. The commit event does occur however if there are records matching the find criteria. My expectation would be for the commit event to fire whether records match the find criteria or not.

                                   Thank you again for taking the time to consider this issue report,

                                   Dave Bartczak
                                   Programmer-analyst
                                   Informatique Direct Impact Inc.

                              • 12. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                                philmodjunk

                                     I suggest taking a look at the scripted find examples in this thread: Scripted Find Examples as source of ideas for a possible work around to handle this issue.

                                     Note that there is no "pause" anywhere in those scripted examples. And the "records not found" dialog never appears when these scripts are run.

                                     And if you have FileMaker Advanced, you can set up the menus sets for this layout such that clicking Perform Find in the tool bar performs a script of your own design and this also will then work around this issue as you can do all the "prefind" processing needed by adding to to the start of this script before the find is performed.

                                • 13. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                                  philmodjunk

                                       An Entry in the Known Bugs List has been linked to this Issue Report. If you have any questions/comments/corrections, please post them here or in a new thread. Please do not post such information to the Bugs List thread.

                                  • 14. Re: Triggering OnRecordCommit before Perform Find does not work is no records are found prior to commit
                                    DaveBartczak

                                         I have looked at the scripted find examples that you posted which require a global field and a trigger/button to fire the script which controls the whole find process. For some simple routine tasks it would be ideal, but in this case, the myriad of possibilities of users experienced in using the find mode makes your solution a long and arduous development track which I know the main user will not consent to pay.

                                         The custom menu would be an acceptable workaround, yes. I am willing to advance that in the considerations of migrating from FileMaker 11 (current) to FileMaker 12 (future) when the time will come to  submit the idea of migrating to the user. Having Custom Menus with FileMaker 11 is also not a good option since it received an upgrade in flexibility in version 12, and is more cost-effective to wait until version 12. Note that I did all my examples in this thread using FileMaker 12v4.

                                    1 2 Previous Next