1 2 Previous Next 16 Replies Latest reply on Jan 30, 2012 8:33 PM by philmodjunk

    Getting the scanner to read our bar codes and take action in FM Pro

    LeonGatewood

      Title

      Getting the scanner to read our bar codes and take action in FM Pro

      Post

      I run a day shelter for the homeless.  Each client has a client number on his picture ID.  We have successfully added barcodes to these IDs in FM Pro. Each barcode, however, is simply the client number translated into barcode.

      Our scanner is hooked up via USB cable to our computer.  (We have FM Pro 11 Server and a number of FM Pro 8 terminals.)

      When each client enters our center, we want to be able to scan the barcode on their ID, and automatically note the current date, current time and that they entered our center (all in FM Pro).  Can anyone let me know the simplest way to do this?  Do we need to embed the script at the front of the bar code?  Can anyone give me a rough idea of how the script should read?  And how, for instance, I would translate "Control 1" (the instruction to perform the script) into something I could put in a barcode field?

      We would like to do much the same thing at a different terminal except the 2nd terminal would automatically say the date, and time that a client got a meal.

      The fields are set up in FM Pro already, I just don't know how to embed the proper info in the barcode so the scanner knows what to do to begin the process.  The three field names are 1) Time 2) Date and 3) EntryMeal.

      Will this work even though our scanner is not directly connected to the keyboard?

      Thank you in advance for any help!

        • 1. Re: Getting the scanner to read our bar codes and take action in FM Pro
          philmodjunk

          Upgrading to FileMaker 10 or later would provide more options, but even back in FileMaker 3 or 4 you could use the following method:

          1) research the tech info on your scanner. You need to figure out how to append a specific character, the character for the enter key (not return) to the end of your scanned data. Some scanners include "programming" barcodes that enable you to do this, others come with software for configuring your scanner.

          2) Once you can configure your scanner to add the enter key character  Char ( 10 ), you can use the following script to process your bar code scans:

          Go to Field [Yourtable::globalTextField]
          Loop
            Pause/Resume indefinitely
            #put code here to process the scanned data, create a record, perform a find, whatever
          End Loop

          Click a button to put the cursor in this global field and the loop will execute and process your scanned data each time you scan a bar code. The enter key character appended to the end of the scan is what clicks the continue button on the paused script for you with each scan.

          To exit this endless loop, use buttons or scripts with Halt Script (either as the button option or the last step in the script) to terminate it.

          • 2. Re: Getting the scanner to read our bar codes and take action in FM Pro
            LeonGatewood

            PhilMod,

            Thanks for the info.  We have successfully figured out how to put the enter command at the end of each barcode on each client ID.  In find mode, if the cursor is in the barcode field, the scanner will successfully scan the barcode and take us to the appropriate client record.

            In browse mode, we also have a script that will successfully insert the data we want to result from each scan (current date and time) into several fields in the same portal on our layout.

            We are having trouble connecting them so that all this occurs automatically after one scan of a client ID.

            I think you are suggesting that a Button should trigger the whole script.  We have created a global text field (GTF).  Should entry into the GTF itself be the Button?  Or should the exiting from the GTF be the Button?  I'm not sure what you mean by, "Click a button to put the cursor in this global text field."

            Thank you for you help!

            • 3. Re: Getting the scanner to read our bar codes and take action in FM Pro
              philmodjunk

              You have to start up the script in some way. The only ways you can start up a script in FileMaker 5 is: when the file opens, when the file closes, when a button set to perform a script is clicked, or when you select the script from the scripts menu.

              You would click the button to perform the script I described in my last post. The go to field step puts the cursor in the correct button so that data from your scanner is input into the correct place.

              Note that I specified a global text field. With global storage you can set up a script like this to find data:

              enter Find mode[]
              Set field [BarcodeField , globaltextfield]
              Set Error Capture [on]
              Perform Find[]

              Thus from one global field, you can look up data with a find and you can also enter data in a related table using the data in this same field from just one scan of the bar code.

              • 4. Re: Getting the scanner to read our bar codes and take action in FM Pro
                LeonGatewood

                I realize I need to use a button to initiate the script but sorry I'm having trouble understanding which field should serve as the Button.  Here's a copy of our script which might help you assess what's wrong.   Maybe the first line of this script should not be here?  Which field should the cursor be in when the barcode is scanned?  Which mode should the database be in?  Thanks

                Go to Field (Table1::Global Text Field)

                Loop

                Pause/Resume Script (Indefinitely)

                Enter Find Mode ()

                Set Field (Table2::Barcode; table1::Global Test Field)

                Set Error Capture (On)

                Perform Find ()

                Pause/Resume Script (Indefinitely)

                Go to Portal Row (Select; Last)

                Insert Current Date (Select; Table1::Current Date)

                Insert Current Time (Select; Table1::Current Time)

                Insert Text (Table1::EntryMeal2; “Entry”)

                End Loop

                Halt Script

                 

                 

                • 5. Re: Getting the scanner to read our bar codes and take action in FM Pro
                  philmodjunk

                  No field would serve as the button. A button would be the button. And apologies for somehow thinking you were using 5 instead of version 8. What I said goes for version 8, but the syntax in my script example was version 5 specific. Fortunately, you seem to have correctly translated the example code.

                  Hmmm, should have put Go to field as the first line inside the loop so that the cursor is returned to the global text field at the start of each loop. My mistake there.

                  Why the second pause/resume step? (I'd guess just to watch the script to see if it's finding records at this point.)

                  The Halt script step outside the loop will never execute here. You'd halt this loop with a button that performs a different script with Halt script or which has "Halt script" specified in button setup instead of the default "resume" option in the "current script" drop down.

                  My personal preference is not to interact directly with portal rows if there is a reasonable alternative. In this case you can go to a layout based on the portal and create the new record there. It's just a bit less vulnerable to layout changes "breaking" your script at a future date. Don't worry about this detail now. You can change it later if you want after the basic scan loop is working for you.

                  • 6. Re: Getting the scanner to read our bar codes and take action in FM Pro
                    LeonGatewood

                    I created a button that's just a button.  But short of tripping the button with the mouse, how do I trip it?  How do I get the action of scanning each barcode to trip it (and by extension, the script)?

                    What I was hoping for is that each client would enter into our day center, scan the barcode on his ID, and the time and date he entered would automatically be noted in FM Pro.  If possible, we don't want someone to have to be sitting at a desk and hitting a button after each scan.  Is this possible?  Thanks.

                    • 7. Re: Getting the scanner to read our bar codes and take action in FM Pro
                      philmodjunk

                      In FileMaker 9 and older, you have to click the button to get this started. The other option is to find a plug in that makes it possible for events to perform scripts and then you'll need to work with the options they provide.

                      But you only need to click the button a single time. Then you stay in a loop that lets you scan bar codes repeatedly--no need to click the button after each scan, just once at the start of each day.

                      • 8. Re: Getting the scanner to read our bar codes and take action in FM Pro
                        LeonGatewood

                        Okay, I think we are making progress and I'm beginning to understand how this thing is supposed to work.  Our current sticking point is that we have to manually hit the Continue button in order to execute the find.  Is there a way to insert a "continue" command into the script so it will do it automatically?

                        It doesn't seem like when the cursor is in the global text field (GTF) and we scan the ID that the "enter" part of the barcode is doing anything except creating a return space inside the GTF. 

                        Note:  When in the Find Mode, if we put the cursor in the barcode field and scan one of our ID's it does find the person suggesting the embedded "enter" code is working. 

                        Thanks for any help.

                        • 9. Re: Getting the scanner to read our bar codes and take action in FM Pro
                          philmodjunk

                          Remove the second pause/resume step.

                          Go to Field (Table1::Global Text Field)
                          Loop
                                 Pause/Resume Script (Indefinitely)
                                 Enter Find Mode ()
                                 Set Field (Table2::Barcode; table1::Global Test Field)
                                 Set Error Capture (On)
                                 Perform Find ()
                                 Pause/Resume Script (Indefinitely)
                                 Go to Portal Row (Select; Last)
                                 Insert Current Date (Select; Table1::Current Date)
                                 Insert Current Time (Select; Table1::Current Time)
                                 Insert Text (Table1::EntryMeal2; “Entry”)
                          End Loop

                          • 10. Re: Getting the scanner to read our bar codes and take action in FM Pro
                            LeonGatewood

                            PhilMod,

                            I had already removed the second Pause/Resume line but I could see how you would think that was the problem.

                            Our mistake is that we embedded "Return" instead of "Enter" in the barcode.  I realize you warned us about this in your instructions but the distinction was lost on me.  No longer!  Once we find the barcode code for "Enter", we should be okay.  Thanks for all your help.

                            • 11. Re: Getting the scanner to read our bar codes and take action in FM Pro
                              LeonGatewood

                              We are having trouble programming our Symbol scanner to automatically hit the enter key (Char 10 aka 6058) after reading each barcode.  We know how to program it to hit carriage return but not how to hit the enter key (the one on the number keypad).

                              It looks like we will have to embed that info at the end of each barcode on each ID.  Toward that end, we are trying to create these barcodes-with- enter-on-them using a calculation field.  Here's the instructions for the calculation: 

                              IDAu_Code128( IndivID & Char(10))

                              "Indiv" is the ID number of the client.

                              Upon trying to create this calc field, we are getting an error message saying, "This function cannot be found," and it highlights "Char".  Any ideas about what we are doing wrong?

                              We have FM PRO 8.  If we can't do it in FM PRO 8, is there a way around that?

                              Thanks for any help.

                              • 12. Re: Getting the scanner to read our bar codes and take action in FM Pro
                                philmodjunk

                                According to a quick check in FileMaker help, Char was a new function added with the release of FileMaker 10.

                                If you were to upgrade to FileMaker 10 or 11, you could use either Install OnTimer or OnObjectExit to continue the process.

                                • 13. Re: Getting the scanner to read our bar codes and take action in FM Pro
                                  LeonGatewood

                                  Our server is FMPro 11.  Could we create the calc field on the Version 11 computer, and then attach the scanners to version 8 computers?

                                  • 14. Re: Getting the scanner to read our bar codes and take action in FM Pro
                                    philmodjunk

                                    The client machine to which the scanner is attached would need to run FileMaker 10 or newer. You could "swap" installs, making a copy of 8 your host machine and the client where you scan data could be version 11.

                                    1 2 Previous Next