How to use the CSV_LOOKUP Component

Last updated: Nov 5th 2022

The CSV_LOOKUP Output Component performs a search inside a CSV file by looking for a value inside a specific column of the file and returns the value in the same row of another column of your choice.

Once a correspondence is found the result will be redirected to the Keyboard emulation and CSV output.
In addition, the value will be accessible from the other components through the csv_lookup variable.

Parameters

Parameter name Description
Skip Output If enabled, the CSV_LOOKUP 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
  • woocommerce
  • google_sheets

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

CSV Input file path The absolute file path of the CSV file to use as a source for the lookup.

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 to search in
Result column Index The column number (starting from 1 for the left-most column of the CSV file) that contains the values that should be returned when there is a match
Not Found value The text to output when the lookup doesn’t produce results

Output

The output value of the CSV_LOOKUP component corresponds to the item of the first row that matches the Search value field.

Example

Let’s say that you need to type the name of the items that you scan in one of your programs.
You can use the CSV_LOOKUP component to perform a real-time lookup to a CSV file and output the corresponding value.

 

Step 1 – Create a CSV input file

The CSV input file will act as a source of the information to associate the barcodes to the corresponding name.
In this example, we’re using Excel to create the CSV file, but you can use any other text editor like Notepad, as long as you correctly format the data as comma-separated values.

Put in the first column all the possible barcode values and in the second column the value of the name that you want to associate to each barcode, like this:

input csv file screenshoot

 
 

Step 2 – Save the CSV file

From the File menu select Save as, and make sure to select the .csv format, like this:

save as screenshoot

 

☝️ Note: Excel may save the file using the semicolon ; instead of colon , as delimiter character.
 
You can verify it by opening the .csv file with the Notepad program. In that case, don’t forget to set the appropriate delimiter character in the server settings shown in Step 4.

 
 

Step 3 – Add the CSV_LOOKUP component

Drag and drop the CSV_LOOKUP 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 4 – Configure the CSV_LOOKUP component

To edit the CSV_LOOKUP parameters click on it.

For this example, all the parameters can be left to the default value, except for the CSV Input File Path field, where you have to put the path of the file you saved in the previous step.

It should look like this:

save as screenshoot

Comments

  1. I want to use the output of CSV_LOOKUP to a conditional IF function but it isn’t work
    I put an if component with: csv_lookup == “S”, where “S” is the result of the csv_lookup function but don’t work. it just go as false.
    If I use some javascript function like csv_lookup.substr(1) it give me an error:
    TypeError: null is not an object (evaluating “window[“xxxxxxx…”].substr)

  2. If there is a match in your csv can you make the phone application beep or is it the server application that beeps?

  3. Is it possible to combine the csvlookup with the text-box? So I want to lookup a value which should be displayed in a text-box but should be able to edit it manually if wanted.

    1. Yes, you can do that by using the {{ csv_lookup }} syntax inside the TEXT Component default value option. (App version required: v3.14.0)

  4. Is possible combine lookups?
    ean-code.csv & code-inv.csv

    The firs have multiple ean one code.
    ean|code
    Second have code description, stock, price and image.
    code|desc|stock|price|path\name.jpg

    The idea is scanning a barcode, lookup the code, and with this code show form with the rest product info and be able to modified stock.
    For the image the csv only have the path, obvious.

    1. Yes, you can inject the value of the first lookup result into the second lookup Search value using the {{ csv_lookup }} syntax. Then you can format the result using HTML and show it inside an ALERT component. To show an image you need a web server though. Please get in touch so that I can set it up for you.

  5. Hello,
    Great Features!! Is it possible to get the lookup value from the sheet in the server system to the phone application?
    Eg: If I am scanning an AWB number, I should get the instructions for it in my mobile app.
    If this is possible then it solves a ton of problems for me!!

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

Related posts