7 Replies Latest reply on Mar 31, 2014 9:30 PM by philmodjunk

    Scanning a barcode 'wherever I am' - is it possible



      Scanning a barcode 'wherever I am' - is it possible


           I have a field called "Status" - values are OPEN and CLOSED (default = OPEN)

           On a layout called 'Close orders' there is a field for OrderStatus than when I scan a barcode with an ordernumber or manually enter the ordernumber, the Status changes to CLOSED.

           This works great but here is what I would like to do .....


           The above relies on the user clicking into the 'Status' field and indeed being on the 'Close Orders' layout.

           Is there a way where I can, say, encode a set of characters in front of the ordernumber in the barcode which would first move the focus to the status field then enter the order number? Better still this would work regardless of the layout I'm in.

           For example the barcode normally has WE34F4F5 - just the order number. What I would like is to prefix it with say, %$, and the %$ would force it to ...

           1. Go to Layout Close Orders

           2. Go to Field Status

           3. Enter the rest of the barcode characters - the order number

           Hope that makes sense







           I have a system where I can scan an ordernumber barcode into a field which fires a script that changes the field's value to CLOSED.

        • 1. Re: Scanning a barcode 'wherever I am' - is it possible

               It depends on what you are using to scan the barcode. If you have a barcode scanner working in keyboard emulation mode connected via USB to a computer with FileMaker Pro running, then the trick is to consult the technical data for your specific scanner to configure it to append additional text to the beginning of your scanned data. I automate a Mag Strip Reader here in that way. The OnLayoutKeystroke Trigger is tripped when the user scans the data and the script performed by this trigger checks for the leading characters and puts the cursor if they are present and does nothing if they are not.

               Here's  thread on the concept: Need help writing script to integrate barcode scanning

               If you use an iOS device such as an iPhone or iPad to scan the bar code, you do not have this option.

          • 2. Re: Scanning a barcode 'wherever I am' - is it possible

                 Thanks Phil, I will investigate this over the next week and get back to you if I have questions.

                 Note, I can't modify the scanners as they are owned by our customers using our FM solution. They use the scanners for other purposes as well.

                 The escape sequence will have to be part of the barcode itself which is generated by us containing randomly generated 'keys'. It will always have 8 characters (either a unique 'subject key' or unique 'order key') So I will have to put the leading characters in front of the key characters.

                 My intention is that scanning a subject key will automatically find the subject with that unique key. Scanning an order key will automatically mark that order as closed.

                 The prefix I'd like to use is /%S and /%O respectively. Do you foresee any problems with that? I always have problems using the / character in calculations

                 Appreciate your help


            • 3. Re: Scanning a barcode 'wherever I am' - is it possible

                   If you can encode it as the beginning of each barcode, then no I don't see a problem. But I haven't tried encoding those characters in a barcode so I am assuming something works that I haven't actually tried to do.

              • 4. Re: Scanning a barcode 'wherever I am' - is it possible

                     Sorry Phil I haven't got past first base. I created my test script (TEST1) - like this

                     If [Get(TriggerKeystroke) ="7FYTQMET"]

                     SHOW CUSTOM DIALOG [It worked"]

                     End If

                     I then set the script trigger for the layout OnLayoutKeystroke -Perform Script TEST1

                     I go to my layout and scan a barcode with those keys or indeed try entering them by hand

                     I get the message "Before typing click in a field or start a new record ...."

                     How do I get around that?



                • 5. Re: Scanning a barcode 'wherever I am' - is it possible

                       Get ( TriggerKeystroke ) returns a single character, not a string. That's why the example script tests for both a single character and a modifier key code. It's checking for the combination of the tilde (~) and both the capslock and shift keys down. I judged that to be a sufficiently rare key combination to something that the user wouldn't press by accident. That was something I could configure the scanner to put at the beginning of all scans.

                       To detect 3 visible characters such as /%S, you'd need to collect each keystroke in a global variable until you can test for all 3. That seems pretty problematic to do and not have it adversely affect normal data entry into your layout.

                       I'd try to use single visible characters that can't be typed as a single key or shift key other key pair (capital letters) from your keyboards. That might be the Euro symbol  if your systems don't use that currency or such if you can barcode such symbols.

                  • 6. Re: Scanning a barcode 'wherever I am' - is it possible


                         It needs to be /%S because these barcodes are produced out of my control - by third party production software. When scanned into that software it finds the subject in question. I want the same behaviour with the same barcodes.

                         I'm curious as to how a variable would work? My script could start with

                         Set Variable $~ to be equal to /%S

                         but then don't I need

                         Get (TriggerKeystroke) = $~      which is 2 characters?

                    • 7. Re: Scanning a barcode 'wherever I am' - is it possible

                           So you have no control over what characters are encoded in the barcode?

                           Keep in mind that you only need the initial character to put the focus into a text field reserved for that purpose. The code to process the scanned code to do the needed action can take place after the data is fully scanned into the field.

                           If the layout is set up with other fields for data entry, my original thought was that a variable wouldn't work well as it will keep the text entered into the field from being visible until you enter the 4th character--which produces a pretty crummy user experience.

                           With further thought, it might be possible to echo the keystrokes to whatever field has the focus while avoiding triggering the standard error message that pops up if no field has the focus when you press a key and then deleting the last three characters if it turns out that all three characters make up the initiation code. But it would not be a simple script and would need to be tested against a barcode scanner to make sure that it actually works.

                           If you use OnLayoutScriptTrigger to preprocess each keystroke, you can use Exit Script [False] false to keep the keystroke from being processed and thus that character being entered into a field.

                           And this script step:

                           Set Variable [$$Keystring ; value: $$Keystring & Get ( TriggerKeystoke ) ]

                           will keep the values in a variable until you have 3 characters input and then you can test the value of $$Keystring to see if the needed code was just input.