Multiple Scans
A function can be implemented when using external hardware to read magnetic strips, barcodes, or RFID tags and populate the string into a single field.
This requires two inputs and a simple script.
readdata (Text, RFID, Barcode)
displaydata (Text Area)
"readdata" will be the data column name of the hardware widget that you want to use, or text element (if you are scanning a barcode). This widget needs to have a dynamic value set to an empty string.
Dynamic Value: readdata=""
The next widget will be a text area with a data column name of "displaydata" that contains the code below in the Dynamic Value to take each scan and populate a long string with each entry separated by a comma and a space.
if(readdata != ""){
if(displaydata != "")displaydata += ", ";
displaydata += readdata;
}
Each new entry will be added to the list as long as it is unique. For example if we have two cards "A" and "B". I can scan card A three times in a row and only have one entry in the text area.
Ex. "A"
If I scan card B in between each scan of A, then it will populate with the following.
Ex. "A, B, A, B, A, B,"
Comments
2 comments
If using the Manatee widget with this code snippet, you need to modify the dynamic value in the Text Area to match the sample below. The main difference is adding ".raw" parameter to the last line.
if(readdata != ""){
if(displaydata != "")displaydata += ", ";
displaydata += readdata.raw;
}
If you want to replace the comma with a line break then "\n" will work instead of ","
Please sign in to leave a comment.