1 2 3 4 Previous Next 58 Replies Latest reply on Mar 30, 2015 11:36 PM by micagordon

    Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11

    PhillipEnriquez

      Title

      Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11

      Post

      Hello all,

      I need to create a database in FileMaker Pro 11, that utilizes a barcode system, for hundreds of video tapes.  I designed the layout and have included a text field named Barcode.

      Upon scanning a barcode, I would like to:
      -create a new record
      -access/edit a record

      Initially this seemed easy to do, but I have spent the past 4 days  researching, reading posts from many different forums (including this  one),  and trying out different scripts without any success.  I have a  very basic understanding of what must be done, but  I just can't seem to  figure out the correct scripts to use Please someone help me, my head is about to explode

      Thank you for your time and I appreciate your assistance,
      p

      p.s. here is the most current multi-line script I've tried:

      Go to layout ["tape library"]

      Go to field [tape library::Barcode]

      Loop

        Pause/Resume Script [Indefinitely]

        New Record/Request

        Set Field [tape library::Barcode]

      End Loop

        • 1. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
          philmodjunk

          Does your barcode scanner support "keyboard emulation"?

          That means you hook up your scanner and each time you scan a barcode the scanned code is input into the computer just as though a very fast, perfect typist typed it in.

          Do you have FileMaker 10 or 11?

          OnLayoutKeystroke can be a very effective "trigger" for performing the script you need here to make sure that the data is scanned into the right text field.

          Do you know how to configure your scanner to include additional text at the beginning and end of the barcode data? Consult your user manual, or scanner's tech support to learn how if you don't. This is a key feature supported by most scanners and we can use the above mentioned trigger to exploit this in your solution.

          When you say you want to:

          -create a new record
          -access/edit a record

          Do you want a script that searches for a record with the barcode's data and creates a new record for it if one does not already exist?

          • 2. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
            PhillipEnriquez

            Hi PhilModJunk.  Thanks for your reply.

            My barcode scanner does support keyboard emulation.

            I have FileMaker Pro 11.

            Could you provide me with a sample as to how you'd implement OnLayoutKeystroke within a script?

            I'm consulting my scanner's tech support to learn how to configure it to include additional text at the beginning and end of the barcode data and they asked me what I am trying to add.  They said that they could add characters, but not whole words.

            I do want a script that searches for a record with the barcode's data and creates a new record for it if one does not already exist.

            • 3. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
              philmodjunk

              They said that they could add characters, but not whole words.

              Since a word is made up of one or more characters, that's a strange statement form them to make. All we need is a character or two. If it can include modifier keys such as shift, ctrl--especially when used in combination, you have a nice key combination that the trigger's script can use. If you can then add either Tab, Return or Enter to the end of the scanned text, we have one method for processing the data post scan. If not there's ways to program in a small delay before trying to process the scanned text.

              The first part is very simple. Here's an example from one of my own databases:

              IF [Get ( TriggerKeystroke ) = "~" and Get ( TriggerModifierKeys ) = 3 ]
                 Go To Field [YourTable::YourbarcodeTextField]
                 Exit Script [False]
              End IF

              The scanner that triggers this script is programmed to precede the scanned text with Shift-capslock ~, a very unlikely key combination to be pressed by the user. Any other keystrokes are ignored by the user so data entry on the same layout can proceed normally.

              We add an Enter key character to the end of the scan and have set up the field's behavior so that the Enter key exits the field. That way an OnObjectExit Trigger can then be used to perform the script we use to process the data entered by scanner into this field.

              If you can't append a character like this to the end of the scanned text, you can add an Install OnTimer Script step just before the Exit Script step to perform the second script one or two seconds after this script exits. You may need to run tests to make sure that you have a long enough delay to capture all the text every time. If you use this option, add this step:

              Install OnTimer Script [] //note the empty parameters

              To your second script to keep OnTimer from making additional calls to the second script.

              • 4. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                PhillipEnriquez

                I have to email tech support in the morning the specific characters I want and they'll email me back with the necessary sheets of paper that contain barcode data which i'd need to scan in order for those characters to appear before every barcode data i scan from then on.

                Will the script you provided me:

                IF [Get ( TriggerKeystroke ) = "~" and Get ( TriggerModifierKeys ) = 3 ]
                   Go To Field [YourTable::YourbarcodeTextField]
                   Exit Script [False]
                End IF

                work in the database that I'm trying to build?

                • 5. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                  PhillipEnriquez

                  Do you know how to configure your scanner to include additional text at  the beginning and end of the barcode data? Consult your user manual, or  scanner's tech support to learn how if you don't. This is a key feature  supported by most scanners and we can use the above mentioned trigger to  exploit this in your solution.

                  I've just configured my scanner to precede the scanned text with Shift-capslock ~ and follow it with the Enter key.

                  Now how would I implement OnLayoutKeystroke into a script that searches for a record with the barcode's data and creates a new record for it if one does not already exist?

                  • 6. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                    philmodjunk

                    You wouldn't.

                    The OnLayoutKeyStroke trigger just puts the cursor in the correct field to receive the scanned data. The OnObjectExit trigger specified for the this same field and which is tripped by the Enter Key at the end of the scan if you set up the field's behavior to exit the field when enter is pressed, will perform that script.

                    The script is simplest if you set up the field that receives the scanned data to be a text field with global storage specified. I've named it "GlobalBarcodeField" in the script. Keep in mind that you have two barcode fields, one for recording the barcode of each item in your table and one for receiving the data from each scan:

                    #Script must be performed on a layout based on the field being searched by the find here
                    Enter Find Mode [] // clear the pause check box
                    Set Field [YourTable::YourBarcodeField ; YourTable::GlobalBarcodeField ]
                    Set Error capture [on] // keeps FileMaker from interrupting script with a dialog if no record is found
                    Perform Find []
                    IF [ Get ( FoundCount ) = 0 ]
                        New Record/Request
                        Set Field [YourTable::YourbarcodeField ; YourTable::globalbarcodeField ]
                    End If

                    • 7. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                      PhillipEnriquez

                      Is OnLayoutKeyStroke also referred to as OnObjectKeystroke?

                      Would I set the script you provided to the OnLayoutKeystroke trigger as well as the OnObjectExit trigger for the GlobalBarcode field?

                      How did you assign both YourBarcodeField & GlobalBarcodeField to one Set Field?

                      • 8. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                        philmodjunk

                        1) They are different triggers. Open Layout setup and click the script triggers tab to find the layout based script triggers like this one.

                        2) You have two scripts and two triggers. The first is tripped by the leading text and selects the field where you want to have the scanned text entered by placing the cursor into it. The second is tripped when that field is exited--accomplished by that return character if you specify that behavior for return characters in the inspector. It may help you to picture your scanner as the "Ultimate Highspeed Typist". When the "typist" presses "Shift-capslock ~", the first script is performed and any further text entered by the "typist" will appear where you see the cursor. When the typist exits the field by pressing Return, the second trigger fires and performs the second script to search your database and create a new record if the data doesn't match any existing records. You can even test these two scripts without using your scanner just by manually pressing the keys needed to trigger each script.

                        3) I didn't. The barcode scanner enters the text into the global field for you between the first and second scripts. The set field moves the data from this global field into the data field in your table, first as criteria in a find request and then as data in a new record if the record is not found.

                        • 9. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                          rjlevesque

                          Begining and end characters depend on the individuals use and needs, they aren't required.

                          What barcode are you using also? Barcode 3 of 9, Barcode 128, etc. That will make a big difference on what you wish to accomplish.

                          Are you generating these barcodes or are you attempting to use the pre-existing barcodes on a commercial tape case?

                          • 10. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                            philmodjunk

                            The beginning and ending characters trip the needed script tirggers so that FileMaker responds to and correctly processes the data input from the scanner. They are not actually input into the database field.

                            Regardless of the barcode font used, this would be necessary to fully auto-mate the scan process in any solution that I can imagine.

                            • 11. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                              PhillipEnriquez

                              1) Got it.

                              2) I'm aware of the two triggers and one script (the one you provided earlier; the second script).  But what is the first script?

                              3) When I try to Specify target field for Set Field it only allows me to choose one field, either YourBarcodeField or GlobalBarcodeField, not both.

                              Regarding the two barcode fields, you said one was for recording the barcode of each item in your table and one for receiving the data from each scan.  What will the text appear as for both fields?

                              • 12. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                                PhillipEnriquez

                                @rjlevesque

                                I'm using pre-existing Code 39 barcodes.

                                • 13. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                                  rjlevesque

                                  @Phil - Nope, don't use them at all in my flagship solution here. The application of the barcode is what determines whether or not you need a start and end character, which in your method, you do. In my method I do not need any additional trigger characters, but in my solution I am actually reading the barcode and parsing the scanned text that it grabs. And no, of course the start and end characters would not be put into the data field...they are nothing more than a trigger point to mark begining and ending of the barcode data. This is especially useful for batch scanning techniques used in some software applications so that you can actually run thousands of barcodes into a system as one single string, making the process mega fast.

                                  And actually a barcode type does make a big difference depending on your application. Whether or not it is a UPC, or DIN, or 128 or 3 of 9 makes a hug difference depending on your needs. Each specific barcode in industry is standardized and each one has its own specific use and functions, such as those used by FEDX for example, the DOT MATRIX style with 3D imagery inside, or an ISDN used by books. A barcode font is not just a representation of the alphabet such as a normal font would be, these are specialized character sets to create a barcode (for example some barcodes can't create or read numbers). All these have been decided upon and standardized, so gentlemen I tell you, a barcode is not just a barcode and a barcode is not just a font. And YES, start character, end character, your specific barcode needs, and the barcode type you use or intend to use all makes a huge difference depending upon your application....   

                                  Smile

                                  • 14. Re: Creating a new record/accessing a record upon scanning a barcode FileMaker Pro 11
                                    philmodjunk

                                    All true and I agree. You do have to fit the barcode to your needs, but once scanned into your computer, it's alpha-numeric text like any other--even 2D fonts. My concern here is to suggest a flexible, error tolerant method for getting FileMaker to respond smoothly to input from the scanner.

                                    I prefer the method I've described here and have successfully used for several solutions:

                                    1) It permits using it on a layout also used for keyboard data entry. Here where I work, we have a screen for filling out an "invoice" (PO really), when our weighmasters scan a driver's license (MSR, but it works just like bar code scanners) and the data is entered into the correct fields with a complex script that not only parses the data into the correct individual fields, but checks for bad data due to bad scans. The leading text enables FileMaker to repond to scanned data in one fashion (Put the data in this field so it can be parsed by the follow on script) and data typed in by the user into other fields is ignored by the OnLayoutKeystroke performed script so data imanually entered by the user takes place in a normal fashion. I'm having trouble picturing any way for FileMaker to respond to the scanned data on such a layout without that leading text to trigger a script and without relying on 3rd party software or a plugin...

                                    2) Timing and error correction. When working with scanners, I've encountered issues where the processing kicks in before the data is fully entered, dropping some of the scanned data. I suppose that if your scanned data is always the same length, you could count the characters input and process them when all are scanned or even a "chunk" of data at a time in cases where complex data is scanned in, but a simple on exit trigger ensures that the data is not processed until the scan is complete. Should an error with the barcode, or the scanner fail to add that final return character, the user's natural reponse is to click something on the layout and this exits the text field--triggering the script--a nice added feature when the media scanned may not always be perfect.

                                    1 2 3 4 Previous Next