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