7 Replies Latest reply on Aug 5, 2016 2:55 PM by philipHPG

    Scripting and Find mode

    dj1up

      So I am trying to create a way to count/scan inventory at our store so we can make sure our numbers stay as accurate as possible.  I have set up a Inventory Table, Line Items Table and a Physical Inventory Table.  I would like to scan an items barcode on the sales floor, then have it looked up in the Inventory table and IF FOUND, record it in the portal.  I have attached my scrip to this question.  Thank you guys

        • 1. Re: Scripting and Find mode
          philipHPG

          You probably want to move line 6 (where you set the $$Search variable) above line 5 (where you enter Find mode). Once you enter Find mode you no longer have access to the previous value of Physical Inventory::Search.

          • 2. Re: Scripting and Find mode
            philmodjunk

            You don't really need to perform a find at all.

             

            You could scan the barcode into a field in lineitems and use an auto-enter option to look up the corresponding data from inventory. If there's no match, no data is looked up and the rest of the line item remains blank. This requires a relationship linking a barcode (or ID field) in line items to a corresponding field in Inventory.

             

            If you use the scripted find option, you might consider scanning into a global field. Then no variable is needed as your script can use the contents of the global field while in find mode to specify search criteria and perform the find.

            • 3. Re: Scripting and Find mode
              dj1up

              Thank you for your help.  Still having problems tho.  But i did end up rewriting the script to include If multi matches come up.  Here's the new script. So what im running into is the scan coming up with no found set.  Even when i copy and past a SKU from my inventory list.

               

               

              #this script was modeled after File Maker Starting Point, by Richard Carlton Consulting.  I have changed there #script to work with my fields and also I'm staying with in one window/layout. 

               

               

              Set Error Capture [ On ]

              #This script will look up the SKU of an item and find it with in the inventory

               

              Set Variable [ $$Search; Value:Inventory Line Items::Search ]

               

              #----------Do the find for the SKU-------------------------

               

              Enter Find Mode [ ]

              Set Field [ Inventory::SKU ; $$Search ]

              Perform Find [ ]

               

              #-------------Collect and evaluate the found count of your scan-----------

              #-------------No SKU's found------------------

              If [ Get ( FoundCount ) = 0 ]

              Beep

              Show Custom Dialog [ Title: "Scan Error"; Message: "SKU was not found in database"; Default Button: “OK”, Commit: “Yes” ]

              Set Field [ Invantory Line Items::Search ; "" ]

              Commit Records/Requests

              [ Skip data entry validation; No dialog ]

              Refresh Window

              [ Flush cached join results ]

              Exit Script [ ]

              End If

               

              #-------------More than one item matches the SKU-----------

               

              If [ Get ( FoundCount ) > 1 ]

              Beep

              Show Custom Dialog [ Title: "Scan Error"; Message: "There is more then one item with this SKU. Pleaes contact a manager to

              resoulve this issue"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]

              Set Field [ Invantory Line Items::Search ; "" ]

              Commit Records/Requests

              [ Skip data entry validation; No dialog ]

              Refresh Window

              [ Flush cached join results ]

              Exit Script [ ]

              End If

               

              #-------------Only one item matches the SKU-----------------

              If [ Get ( FoundCount ) = 1 ]

               

              #-------------Grab ID of the product and store into Variable------------

               

              Set Variable [ $$ID_Item_From_Scan ; Value:Inventory::_IDSacNumber_PK ]

              New Record/Request

              Set Field [ Invantory Line Items::Search ; "" ]

              Go to Field [ Invantory Line Items::Item Type ]

              Go to Portal Row [ Last ]

              Set Field [ Inventory Line Items::_inv_idfk ; $$ID_Item_From_Scan ]

              Commit Records/Requests

              [ Skip data entry validation; No dialog ]

              End If

              script issue search script error barcode Scan

              • 4. Re: Scripting and Find mode
                philipHPG

                I see references to both "Inventory Line Items" (the first Set Variable script step and the last Set Field script step) and "Invantory Line Items" (everything else). Is that simply a typo/auto-correction, or do you actually have two table occurrences with those different names? If you have two table occurrences, that could be the source of the problem.

                 

                Otherwise, I would verify that the field on your layout where you are copying and pasting the SKU is the Inventory Line Items::Search field.

                • 5. Re: Scripting and Find mode
                  dj1up

                  I just have one TOC and my Search field is in my Line Items Table.  let me attach my solution to the this.

                  • 6. Re: Scripting and Find mode
                    dj1up

                    Heres the file@

                    • 7. Re: Scripting and Find mode
                      philipHPG

                      Okay,

                       

                      Your layout is based on Physical Invantory, however the search field you are using is Invantory Line Items::Search. Change line 5 of your script to use Invantory Line Items::Search instead of Physical Invantory::Search, or change your layout to use Physical Invantory::Search.

                       

                      You might want to change the Search field to be a Global field as well.