Use conditions in the Output template
Conditions are useful when the software where you need to put data requires to perform a sequence of actions only when a condition is verified.
The components required to make it happen are the and the component. Their job is to change the flow of execution of the Output template.
Let’s say that you need to put the barcodes that do not start with “9” into another column:
In that case the output template would like something like this:
- The first component acquires the barcode and stores its value in the global variable called “barcode”.
The checkbox is unchecked because we want to skip the output of this component.
- The IF component will perform the check over the “barcode” variable.
- If the condition is true, it’ll allow the flow of execution to continue with the next component that will acquire the second barcode.
- But if the condition is false, it’ll cause the flow of execution to skip to ENDIF component, from which point execution will proceed.
Tip: If you want to add a delay between the acquisitions you can do that by increasing the “Timeout” option from the app settings.
To edit the component, you simply need to click over it:
The IF component is evaluated on the app side when a scan is performed, more in particular when the app is populating Output template.
More condition examples
number == 1
timestamp > new Date().getTime() * 1000
device_name == "John's iPhone"
Have a component to validate dc (digit control)?
If not, you can use a js file that check it?
Or do multiple validations, for length or only numbers, is a limited solution.
Sometimes the reading is partial, I would like the barcodetopc to detect this automated and request a new reading for the save correct datum. I also saw not have an option to move the sequence already entered.
Yes, you can define a Regular expression and use it as a Filter in the BARCODE component. This way it will automatically discard the wrong barcodes and prompt to acquire another one