8 Replies Latest reply on Oct 18, 2012 3:09 PM by timwhisenant

    new record automation


      I have created a Filemaker 12 DB that I created. There is a mag stripe reader attached that when a card is swiped it grabs the ID number into a text field. What I want to happen right after that is that a new record is created and it is ready to swipe the next ID.


      Does anyone know how to automate this?

        • 1. Re: new record automation

          Hello, David.


          I suggest you look at the OnObjectKeystroke Script Trigger. You can write the script in such a way that it does nothing until it receives a trailing character (such as a carriage return), which you can capture using the Code function. When that happens, you can run your automation to create the new record and clear your receiving field, ready for the next input.


          For example:


          If [ Code ( Get ( TriggerKeystroke )) = 13 or Code ( Get ( TriggerKeystroke )) = 10 ]

            Set Variable [ $newID ; captureField ]

            Go to Layout [ {proper layout} ]

            New Record / Request

            Set Field [ table::ID ; $newID ]

            Go to Layout [ {capture layout] ]

            Set Field [ captureField ; "" ]

            Go to Field [ captureField ]

          End If


          Adjust as needed.   





          • 2. Re: new record automation

            Hi David,


            I use a looping script with a barcode scanner which does the same, I use a dialog to capture

            the barcode and let the scanner send a return after the scan, this wil accept the code in the dialog

            and then the script does it magic.


            You could also do this by using scripttriggers on the enter field, but I found the looping script more



            Hope that helps,


            Best regards,


            Ruben van den Boogaard

            Infomatics Software


            • 3. Re: new record automation

              I did try and go to the scripttrigger, but I have been unable to figure out how to send a return after the scan? Has anyone done this? If so did you do through filemaker or was it through the mag strip reader?



              • 4. Re: new record automation

                I have always done this with the mag strip reader.  Most are very simple to add a command at the beginning or the end of a mag read.

                • 5. Re: new record automation

                  So I played with the mag strip reader and got that to work, and then I set the script trigger to "New Record/Request". Now when I swipe the card it works, but it keeps making new records until I hit the escape button, within a few seconds I will have 6000 new records. I guess I made a bad assumption that with a New Record request it would add 1 new record and sit there waiting for the next input. Any ideas out there on how to have it generate one new record?

                  • 6. Re: new record automation

                    If I had to guess, your script trigger's trigger event is looping for some reason.  Can you share the type of script trigger your using and what that trigger script is doing?


                    You can also use FMPA's Script Debugger to see what the process is that is causing this looping action.

                    • 7. Re: new record automation

                      You don't say which script trigger or what the script looks like. Both are essential for debugging this problem.


                      My suggestions based on my own Scanner solution.

                      1. Use the On Object Exit Script Trigger.

                      2. Have another field able to be entered so the cursor does NOT end in the same field after the exit.

                      3. Make the scanner field the first one in the Tab order.

                      4. Have the script do any data validation required, do not use Field level validation.

                      5. Have the script always STOP after creating the new record. Do not put it into a loop.

                      Make the last script step be Exit Script ["False or 0"]

                      6. Commit the record before creating the new one.

                      • 8. Re: new record automation

                        At the end of the script try;


                        Exit Script[result: "false"]