Thursday, January 12, 2012

Help with barcode scanner

The field needs to be a global field. (You can't be scanning data into a nonglobal field of a record that doesn't exist yet!)

g.BarCodeScan

The triggering condition could be OnObjectKeystroke; have it call a script that in its first step evaluates Get(TriggerKeystroke). Depending on how your barcode scanner is set up, it will be appending either a hard return (char 13) or a true enter (char 10) after the string of characters that are barencoded; trap for whichever one is appropriate to your barcode scanner; whereas for any OTHER keystrokes, exit the script, end if.

If [ Code (Get (TriggerKeystroke)) ≠ 13] <— or 10 depending on your barcode scanner setup
.. Exit Script
End If

Script continues, therefore, ONLY when Get(TriggerKeystroke) is the return (or enter) key, indicating the end of the string being input via barcode scanner.

Then the rest of the script does this:

New Record/Request
Set Field [YourTable::AppropriateField; YourTable::g.BarcodeScan]
Set Field [YourTable::g.BarcodeScan; ""]

0 comments:

Post a Comment