on 2024 Feb 23 6:24 PM
Hi Experts,
I am using a Android based TC72 device which has a inbuilt scanner.
My requirement is, in a page have a SimpleProperty with OnValueChange calling a rule.
When a user scans a barcode, I have to show an alert and clear the Input Field for next scan.
Issue : Its working for the first time as expected but second time its still retaining the first scan value. (I am scanning two different barcodes alternatively for testing) So my OnValueChange triggering twice. (one with OLD value and again with NEW value).
My Rule Code inside the default function as below
Request clarification before answering.
I am assuming you are using the data wedge configuration for the scanning where the scan value is input into the current cursor location and have a simple property field where the OnValueChange rule is attached.
When you open the page and tap into the field and then scan your first value the OnValueChange rule will be called and clientAPI.getValue() will contain the scanned value. Subsequent scans will trigger the OnValueChange rule again with the new scanned value.
Within your OnValueChange rule you are calling setValue to clear the current scan value. The setValue returns a promise so simply calling clientAPI.getValue() again will still return the current scan value but the promise will complete and the next scan will correctly contain the next scan value.
I tested this using my TC77 and see the expected results where each time I scan I get the current scan value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
MDKClient Version : 23.12.0-002
com.sap.cloud.android.fundation : 7.1.0
-Madhavi Beedam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
12 | |
9 | |
8 | |
8 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.