2 Replies Latest reply on Jun 21, 2012 11:24 AM by EricStover

    Differentiating between Inventory and PO numbers using script

    EricStover

      Title

      Differentiating between Inventory and PO numbers using script

      Post

      I am trying to comprehend how to write a script that will determine if a scanned barcode is a inventory number or PO number. Our Inventory numbers are 5 digits (12345) and the PO numbers are 6 digits that start with the fiscal year (125678). I started with 2 IF statements:

      If[Length(Scan:Scanned Barcode) = 6]

      Perform Script["Scanned PO Number"]

      Else If[Length(Scan:Scanned Barcode) = 5]

      Perform Script["Scanned Inventory Number"]

      End If

       

      The problem I am having is that this script seems to be exiting at the "Else If[Length(Scan:Scanned Barcode) = 5]"  even when a six digit number is scanned. I am not sure if that is a script problem or a script trigger problem.

      I am using the onObjectModify to fire the script when a barcode is scanned. The above script is working when I use onObjectKeystroke, but I was having to manually tap the Tab or Return key (it was so much work ;)). I am on Filemaker 10 on a Mac.

        • 1. Re: Differentiating between Inventory and PO numbers using script
          philmodjunk

          The problem with OnObjectModify is that it will perform the above script with each individual character scanned into the field from the barcode.

          Thus when the first character is scanned in, nothing happens because length is 1, then the second character appears in the field and the script performs again. Now youhave 2 characters and still nothing happens, but when the fifth digit of that 6 digit barcode is scanned in, you now have 5 characters in the field and it is processed as a 5 digit scan before that fifth digit ever appears in the field.

          What I do with scanners is to research their features to learn how to configure them to append a character to the end of the scanned text. I then set it to append either return, tab or enter and set field behavior to recognize that character as the keystroke to exit the field. Now I can set an OnObjectExit trigger to perform the script that processes the scanned data.