13 Replies Latest reply on Feb 25, 2011 3:03 PM by rjlevesque

    Search not working properly HELP!!!

    rjlevesque

      Title

      Search not working properly HELP!!!

      Post

      Ok, so I scan in a number such as 0029 with a barcode scanner. It reads the entry, fires off a script with a trigger.

      --------------------- My Script ---------------------

      I need it to locate the record in question and then edit the record and go back to original layout.

      sshot1.png

        • 1. Re: Search not working properly HELP!!!
          raybaudi

          Try changing the type of the field Functions::Function Read from "number" to "text"

          P.S.: even Stock::Stk_Number must be a text type field.

          • 2. Re: Search not working properly HELP!!!
            rjlevesque

            It is text

            Everything looks as though it should work to me...very stumped and I need this done by 2pm today....ARG!

            • 3. Re: Search not working properly HELP!!!
              philmodjunk

              You have this step:

              Perform Find [Restore]

              What criteria is specified in that step? That restored find criteria might be why you aren't finding the record you expect.

              Have you confirmed that the bar code data is being successfully and correctly entered into the FunctionRead field?

              You might run this with the debugger if you have advanced or you can put a pause just before the set field step that clears the field to check to see what value is actually entered into the field when the bar code is scanned.

              • 4. Re: Search not working properly HELP!!!
                rjlevesque
                I have now changed it several times trying to figure out what is going wrong. In the perform field is: Find Stock::Stk_Number = $$MyStock
                • 5. Re: Search not working properly HELP!!!
                  rjlevesque

                  I would rather have it grab the scanned barcode, search for the record, modify it, and clear the field ready for the next scan all in one script. I have tried doing it with one script, and breaking it into two scripts.

                  Botton line is I cannot get it to find the correct record to complete the script. Pulling my hair out...

                  • 6. Re: Search not working properly HELP!!!
                    philmodjunk

                    I used one of my community leader privileges to "suspend" the duplicate posts. I'll report this to Modman so that he can take a look at it.

                    In the perform find [restore] step is: Find Stock::Stk_Number = $$MyStock

                    Since you are already using Set Field just before to enter this same criteria. Clear the restore option.

                    There's a bug with global variables in find mode when the file is hosted from a server that might be an issue here as well. You may need to use a global field instead of the variable.

                    To repeat an earlier question: Have you verified that Functions::Function Read successfully recieves the scanned data and that this data is exactly correct for your find?

                    • 7. Re: Search not working properly HELP!!!
                      rjlevesque

                      Thank you so much for fixing that! =)

                      tried global field, did not work either

                      how would you suggest I verify the scanned data?

                      Would it be easier for you to see the file?

                      If so, where can I place a zipped up file for you to grab?

                      • 8. Re: Search not working properly HELP!!!
                        philmodjunk

                        Let's not go there until we confirm that the scanned data entered into the field is correct.

                        I already suggested several ways that you can check this. If you have advanced, just run the script with the debugger and use the data viewer to watch the contents of the fields in question.

                        You can add a pause step just before you clear the field

                        other options:

                        Add a show custom dialog step just before you clear the field and use it to display the field's contents.

                        After running the script, use Modify Find from the records menu to review the critieria this script entered to see what values were entered into the fields for the find.

                        • 9. Re: Search not working properly HELP!!!
                          rjlevesque

                          Ok, I put in a dialog to show what is in the global field I put my search data in, guess what...it is getting nothing. I even tried setting it to

                          Get (ActiveFieldContents)

                          suggestions kind sir?

                          • 10. Re: Search not working properly HELP!!!
                            philmodjunk

                            Make sure that the cursor is being put in the correct field before the scanned data is input.

                            I implement scans with two scripts and two triggers.

                            First, I configure the scanner to put keystrokes at the beginning of the scanned data. Then I configure the scanner to add either a Tab, Return or Enter keystroke to the end so the scann action automatically exits the field in which I am capturing the scanned data.

                            Script on is performed with an OnKeystroke trigger set on the layout. It simply uses Get ( TriggerKeystroke ) and Get ( TriggerModifierKeys ) to confirm that a scan was initiated. (I use a combination of a single character plus two modifier keys such as shift and caps lock to guard against accidents.) The script then uses either go to field or go to object to place the cursor in the field in which I want to capture the data. The final script step uses Exit Script [false] so that the triggering keystrokes do not effect anything.

                            The second script use an OnObjectExit trigger to do something like what your script does to process the scanned data.

                            • 11. Re: Search not working properly HELP!!!
                              rjlevesque

                              um...ok, i kind of get what you are saying, I mean it all makes sense...but could you break it down with sudo code/text for me so I can see the steps. I need to picture this 3D in my head, I'm sure you know what I mean. hehehe

                              • 12. Re: Search not working properly HELP!!!
                                philmodjunk

                                Copying and pasting from a database design report where we scan data from driver's licenses. (MSR scanners work much like bar code scanners.)

                                If [ Get ( TriggerKeystroke ) = "~" and Get ( TriggerModifierKeys ) = 3 /* Modifier 3 means shift and capslock are down */ ]
                                       Go to Object [ Object Name: "Scan Box" ]
                                       Exit Script [ Result: False ]
                                End If

                                I use Go To Object here because this layout has two copies of the field and I want the cursor in 2 pixel copy to keep the scan process invisible.

                                • 13. Re: Search not working properly HELP!!!
                                  rjlevesque

                                  Go To Object did the trick! Once again thank you TONS Phil. Not to mention telling me about the variable bug, I would have been wracking my brain all night. =)