iFormBuilder JavaScript Tips & Tricks
How do I parse my scanned data?
The below example will demonstrate how to parse data that is returned as a result of scanning a QR Code via the Manatee Element. To set up this functionality, please follow the instructions below.
STEP 1. Add the Manatee Element to your form.
Name your Manatee Element. Take note of the data column name (scan_the_qr_code).
Choose your Symbologies.
Choose your Scanner Effort Level.
In the Dynamic Value field (under the Smart Controls section), place the following JavaScript:
scan_the_qr_code=""
This will ensure that the Manatee data will reset with every new record.
Scan the QR Code:
Result: Joe Schmoe||Hardware Expert||myemail@iformbuilder.com||18001112222
Add the following Widgets to your form:
Hardware, QR Code, or Red-Laser Widget
Data Column Name: my_data
Dynamic Value: my_data = ""
Text Widget **This widget is used to hold the data for parsing
Data Column Name: data_result
Dynamic Value: my_data
Text or Read-Only Widget **Holds the first set of data separated by '||'
Dynamic Value: ((my_data.split("||"))[0])
Result: Joe Schmoe
Text or Read-Only Widget
Dynamic Value: ((my_data.split("||"))[1])
Result: Hardware Expert
Text or Read-Only Widget
Dynamic Value: ((my_data.split("||"))[2])
Result: myemail@iformbuilder.com
Text or Read-Only Widget
Dynamic Value: ((my_data.split("||"))[3])
Result: 18001112222
**This Dynamic Value Statement is saying split up the my_data string into different sections by || character. And the number inside the Brackets are saying select and display the X section. If the string returned is seperated by a different character then || you can simply replace it with the character the string is seperated by.
The separated string looks like this:
0 = Joe Schmoe
1 = Hardware Expert
2 = myemail@iformbuilder.com
3 = 18001112222
Can't find what your looking for? Before submitting a request look here!
Comments
0 comments
Please sign in to leave a comment.