Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3903 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi everybody,
 
I am doing a POS system and I have 2 databases. The first one has the barcodes and descriptions of the products and the second one has the ordered products. I have a layout from which I would like to read the barcodes of the products and then add their information within the other database. To do it, I have a field through which I want to introduce the barcode. This barcode can be introduced handly or with a barcode reader. I have some problems to create the script to read the barcode.
 
Handly:
 
I write the barcode numbers, strike the enter key and a script "1" is started (when strike this key) to capture the barcode.
 
Barcode reader:
 
I click on the field and read the barcode, after that a script "2" is started to capture the barcode.
 
To separate both scripts (1 and 2), in this field I have activated the OnObject Keystroke event and I run this script:
 

Set Error Capture [On]
Allow User Abort [Off]
IF Code (Get ( TriggerKeystroke ) = 13)
Perform Script [“Add barcode”]
Else
Exit Script
End If

Using this script I can read a barcode and the subsequent script runs perfectly but it is impossible to write handly any number within the field. How could I keep both reading options?

 

Thank you very much,

Wardiam

Posted

I don't quite get it.  Why not click on the field to enter the number manually, but create a separate "scan" button to scan the barcode into the field? That would seem more intuitive to me. 

Posted

Hi Matthew,

 

It is a possibility, I would like to have a single field but if I don't get other solution to my problem, I will try your option.

 

Thank you very much,

Wardiam

Posted
IF Code (Get ( TriggerKeystroke ) = 13)

 

This line needs to read:

If [ Code ( Get ( TriggerKeystroke ) ) = 13 ]

The way you have it, the test will always return true. Note that the Else part of the script is unnecessary.

 

--

Note also that if the user enters a return while entering data manually, the same script will run. I didn't quite understand the 2 scripts thing.

Posted

It's true Comment, thanks.

 

I have modified the script following your recommendations and now it works but I had to change the activation event to "OnObjectSave". As you told me I wanted that both actions (handly or barcode reader) run the same script, perfect!!!

 

Now I have other problem, to activate the script I click on the enter key and when the script has finished the cursor goes to the next field. I want to return to the same field, clear it and introduce other barcode. I have tried to use the "Go to field" or "Go to object" commands at the end of the script but the field is only cleared and anyway the cursor goes to the next field.

 

Do you have any suggestions?

 

Thanks again,

Wardiam

Posted

Hi Wardiam,

 

OnObjectSave fires after the event (changes have been validated and saved).   If the script returns true, the original event proceeds normally which  is moving to the next field.  To stop the field exit, use Exit Script[0].  But you also need a way out if you wish to stop the scanning.  I have no barcode scanner here to test it so please, as always, back up first.

Set Error Capture [ On ]
Allow User Abort [ On ]
If [ not IsEmpty ( table::field ) ]
Perform Script [ “Add Barcode” ] 
Clear [ ] [ Select ]
Exit Script [ Result: 0 ]
End If
  • Like 1
Posted

Thank you very much LaRetta,

 

I have tested your script and it works. This is exactly that I wanted it.

 

Thanks again,

Wardiam

This topic is 3903 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.