6 Replies Latest reply on Dec 8, 2010 7:51 PM by Rune

    Scan barcodes into portal rows

    Rune

      Title

      Scan barcodes into portal rows

      Post

      Hi,

      I am trying to get a barcode scanner (SOHO Intelliscanner with keyboard emulation) to insert scanned barcodes into a "serial number" portal on my main layout.

      Basically, when the warehouse people assemble a system they scan all the parts that they out together.. Afterwards they come into the office where they connect the scanner to FM. 

      The scanner then uploads the barcodes into the portal. The problem is that the barcodes all go into the same portal row. I have tried to set a script trigger to input only 1 per portal row but I am getting nowhere..

      I am using FM11 Pro Adv, and am fairly new at this, please help.

      EDIT: here's my script, it's pretty much working now but for some reason it adds an extra blank portal row to the portal, which then sorts it to the top of the rows.. Frustrating!

        • 1. Re: Scan barcodes into portal rows
          Rune

          Hmm, for some reason I struggle with something for ages, but as soon as I post about my problem I seem to solve it myself immediately after submitting the post..

          I am trying to look for duplicate "serial numbers" in my database before populating the portal.. I cannot work out how to do the find:

          • 2. Re: Scan barcodes into portal rows
            RonCates

            Wouldn't you want to enter find mode after entering the loop. If not, after the first time through the loop, it will no longer enter find mode.

            Sorry. Don't have time to get into it more right now. Just happenned to notice that.

            • 3. Re: Scan barcodes into portal rows
              philmodjunk

              Your code seems to imply that g_serialNumbers contains a return separated list of values (Otherwise there's no point to the loop and the GetValue function.)

              How does the list get entered into this global field? And Why? (I'd design the layout to add one serial number at a time and put it through the  "check for duplicates" process as part of a triggered script that executes after the scan of the single bar code.)

              Ron has spotted one problem with enter find mode being outside the loop.

              It also looks like there may be an issue with what layout is current when this script executes.

              It looks like SERIAL NUMBERS LINE ITEMS refers to the portal's Table of your current layout then this script won't work. You should first switch to a layout based on the Serial Numbers Line Items table before making this search of values.

              When you search your current layout in this fashion, you are telling FileMaker to find all records in your current layout that have at least one related record in the portal that matches your search criteria. After you leave find mode, you may thus be on a completely different record and all the related serial number records for that record will be listed in the portal--not just the record or records that matched your search criteria.

              • 4. Re: Scan barcodes into portal rows
                Rune

                Wouldn't you want to enter find mode after entering the loop. If not, after the first time through the loop, it will no longer enter find mode.

                Didn't realise that, thought it would just stay in Find mode for as long as the Loop went on.. Thanks mate.

                Your code seems to imply that g_serialNumbers contains a return separated list of values (Otherwise there's no point to the loop and the GetValue function.)

                That is correct.

                How does the list get entered into this global field? And Why? (I'd design the layout to add one serial number at a time and put it through the  "check for duplicates" process as part of a triggered script that executes after the scan of the single bar code.)

                When I connect the scanner to the PC, and after pressing the "~" key, the g_serialNumbers field gets filled with all the barcodes from the scanner. I initially had the scanner connected directly to the numbers field on the serialNumber portal but couldn't figure out how to make it create a new portal row for each barcode and also the process of finding and warning about duplicates had me puzzled.

                I was rather proud of figuring out the process in the picture by myself, didn't realise it wasn't optimal at all lol. What you are suggesting sounds simpler to me but the problem with being new at FM is that I sometimes find it hard to implement different ways of doing things..

                EDIT: I think I just figured it out?! Does this look ok? It seems to work ok for now..

                Do you think I should abandon all this and go with How does the list get entered into this global field? And Why? (I'd design the layout to add one serial number at a time and put it through the  "check for duplicates" process as part of a triggered script that executes after the scan of the single bar code.) instead?

                • 5. Re: Scan barcodes into portal rows
                  philmodjunk

                  With most barcode scanners, you can set them to append text to the end of the scan. This appended text can be a tab, return or enter character which thus exits the scan field. An on exit triggered script can then be devised to do this one barcode scan at a time.

                  • 6. Re: Scan barcodes into portal rows
                    Rune

                    Yeah I did fiddle around with that first but it never worked for me for some reason, maybe due to my amateur level scripting lol.. I have reworked the above script a bit and it seems to work really well for me now, so I think I'll stick with it (unless of course it turns out to have any flaws or that it slows the program down over time)..

                    Thanks a lot for your help once again!