2 Replies Latest reply on Aug 13, 2015 1:46 PM by philmodjunk

    Barcode scripting questions

    JimZ

      Title

      Barcode scripting questions

      Post

      So I have bar codes assigned to all of my assets in a database. I created a find bar code button so that people can just scan the bar code on the asset and all the info pops up. The only issue I am running into is when someone scans a bar code that is not in the database. When this happens my script runs them through a bunch of prompts that I don't want them having to deal with. What I would like to script is something that prompts them asking if they want to add a new asset with the new bar code. The following is my current code.

      Go to layout [Assets(Assets)]

      enter find mode

      insert from device [Assets::Barcode;Type: Bar Code; Camera: Back; Resolution: Full]

      commit records/requests

      perform find

       

      Not sure if there is a way to say if find returns no matching records than display custom dialog box and cancel find. Any help or thoughts on this is greatly appreciated.

       

        • 1. Re: Barcode scripting questions
          JimZ

          Of course the moment I ask for help I figure it out.
           

          Set Error Capture [On]

          Go to layout [Assets(Assets)]

          enter find mode

          insert from device [Assets::Barcode;Type: Bar Code; Camera: Back; Resolution: Full]

          commit records/requests

          perform find

          If[Get(foundcount)=0]

          show all records

          Show Custom Dialog Box

          End If

          • 2. Re: Barcode scripting questions
            philmodjunk

            You've posted a Filemaker Go question in the FM Pro forum. That's really no big deal, but thought you should know that there's a section intended for FM GO.

            In this case, the question is answered the same for FM GO and FM Pro.

            If you add this script step:

            Set ErrorCapture [on]

            before the perform find step, you will not get the "no records found dialog interrupting your script when no matching record is found.

            You can then use:

            If [ Not Get ( FoundCount ) ]

            To detect the case when no record matching the inserted bar code was found.

            For more examples of scripted finds that you might find useful, see: Scripted Find Examples