Scanning multiple values into one field

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,"
    Was this article helpful?
    0 out of 0 found this helpful
    Have more questions? Submit a request


  • Avatar
    Tony Ruth

    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;

  • Avatar
    Jamelle Legaspi

    If you want to replace the comma with a line break then "\n" will work instead of ","

Powered by Zendesk