Fill in product description when product code entered
  • Michael
    Fill in product description when product code entered

    by Michael » Wed Sep 20, 2006 12:37 pm

    I have a card file I have set-up that I plan to use with a scanner to scan in product codes. When I scan a product code I want the software to fill in the product description. I've created a 40 character field called DESCRIPT which I've placed below my product code field. Any advice gratefully accepted. :-)
  • COBS Tech Support
    Posts:683
    Joined:Fri Sep 09, 2005 8:23 am

    by COBS Tech Support » Wed Sep 20, 2006 12:41 pm

    There are two places where you should add script.

    From the Screen Builder main menu select File|Screen Script.

    Somewhere within here you need to check for event 9 (field changed). Assuming your product code field is called PCODE, the script would be:

    If Mode = 9 .And. Focus = "PCODE"
    If .NOT. IsEmpty(SCRRead("PCODE"))
    If Stock->(Find(SCRRead("PCODE")))
    If SCRRead("DESCRIPT") # Stock->Title
    SCRWrite("DESCRIPT", Stock->Title)
    Endif
    Endif
    Endif
    Endif

    The above is probably sufficient, but you can also double-click on your DESCRIPT field and place this script under the Formula tab:

    If .NOT. IsEmpty(SCRRead("PCODE"))
    Stock->(Find(SCRRead("PCODE")))
    Return Stock->Title
    Endif

Who is online

Users browsing this forum: No registered users and 21 guests