How to use the CSV_UPDATE Component

Last updated: Jun 16th 2021

The CSV_UPDATE Output Component updates the value of the matched items in a file and returns the new value.

Once all the occurrences are updated, the return value will be redirected to the Keyboard emulation and CSV output.
In addition, the value will be accessible from the other components through the csv_update variable.

Parameters

Parameter name Description
Skip Output If enabled, the CSV_UPDATE output won’t affect the Keyboard emulation and the CSV files output.

Search value The text or number to search for inside the CSV file.

You can use the values acquired by the other components by accessing the corresponding variables using the double-curly braces syntax.

Available variables (lowercase):

  • barcode
  • barcodes
  • number
  • text
  • timestamp
  • date_time
  • scan_session_name
  • select_option
  • http
  • run
  • csv_lookup
  • csv_update
  • javascript_function

Example of a possible Search value: {{ barcode }}

New Value The text or number to use to replace the Search value in the CSV file.

Available variables (lowercase):

  • barcode
  • barcodes
  • number
  • text
  • timestamp
  • date_time
  • scan_session_name
  • select_option
  • http
  • run
  • csv_lookup
  • csv_update
  • javascript_function

Example of a possible Search value: {{ number }}

CSV Input file path The absolute file path of the CSV file to edit.

Example for Windows: C:\Users\John\Desktop\db.csv
Example for macOS or Linux: /Users/John/Desktop/db.csv

Search Column Index The column number (starting from 1 for the left-most column of the CSV file) that contains the values where you want to search
Column to Edit Index The column number (starting from 1 for the left-most column of the CSV file) that you want to update
Not Found value The text to output when no items are affected from the update operation

 

Output

The output value of the CSV_OUTPUT component corresponds to the New Value field when at least an occurrence is found.

If no occurrence is found the Not Found value is outputted.

 

Example

Suppose that this is the file you’re working with:

barcode,status
12345,pending
12346,pending
12347,pending
12348,pending

and you want to update the second column to “shipped” when a barcode is scanned.
To do that follow these instructions:

 
 

Step 1 – Add the CSV_UPDATE component

Open the server settings, and drag & drop the CSV_UPDATE from the Available components filed to the Output template field, like this:

 

☝️Note: make sure to position the CSV_LOOKUP after the BARCODE component, otherwise it won’t be able to access the barcode variable.

 
Step 2 – Configure the CSV_UPDATE component

To edit the CSV_UPDATE parameters click on it, and:

  • Set the New Value field to shipped
  • Set the CSV Input File Path field to the file path you’re using as database

It should look like this:

csv update file path screenshot

csv update file path screenshot

 
Step 3 – Save & Apply

At this point, everything is good to go. You can click Save & Apply in the server settings, and scan from the smartphone by tapping the red camera button.

In this example, when you scan the 12347 barcode, the file will be automatically edited to this:

barcode,status
12345,pending
12346,pending
12347,shipped
12348,pending

Comments

No comments found. Be the first to leave a comment.

Your email address will not be published. Required fields are marked *

Related posts