I want to create a website for a study that basically minimizes human error, by taking a picture of a 16 digit code, and outputs 1 of 2 colours. Now these colours will be associated with a code, and the information is on an Airtable CSV. I have started, but I cannot figure out how to pull information from the Airtable after taking a picture of the barcode, and outputing the code. Thanks for the help in advance!
The row id value is not a lookup field. It represents the row # (1, 2, 3, etc.). You’re using it as though it represents the cell value. What you should do is use the find first occurence of block which returns the row number that a search term is found in.
The list of values block would be a Data Source block for the column you want to search and the item block would be the text input or variable value containing the search term. If you get a value of zero back from that, it means the value was not found in the column.
Almost. The list of values block is already a list so you don’t need to put a + list - block in front of it. That will cause problems because it creates a list of lists. Delete that extra block.
When you set a variable, use the set app variable block at the top of the Variables drawer that already has the variable name. Avoid using the set app variable " " block. You need change those blocks so that it just shows set app variable Code to…
I’m not what the next steps would be because I don’t quite understand what you’re trying to do and what the larger context is (what’s the purpose of this?). I would recommend either clarifying here or using ChatGPT to get an algorithm for your project. That can be a useful starting point.
Yes, thanks, I’ll clarify. So, I need to make an app that will minimize human error by scanning a barcode for a study. Each barcode has a code and each code is linked to 1 of 2 colours, and this data is in the spreadsheets. I want the app to output the correct colour that is attributed to the code when scanned.
Your Code and Color variables are going to have the row number where the search value was found. So for example, if you scan the barcode C05202120648900I (hopefully I typed that right!), then app variable Code would have the value 3 since that’s the row in which that Code appears in the data source.
If you then want to get another value from the same row, such as the Colour, you would Get Value of that column for row id app variable Code.
Note: The way you’ve set up app variable Color is probably not useful since it’s only going to find the first occurrence of the value in the Colour column. I would remove that. You also don’t need to have any values connected to the initialize app variable blocks. You can delete the get value blocks that are there. You’ll want to get the values after you find the row numbers.
I made some adjustments, and it kind of works. It outputs the correct output, but only after 2 scans. I fear I may have gotten lucky, and something isn’t correct. Would you mind taking a look? Also, let me know if my project link works.
Add a text input and then set the text input’s text to the green value block. You can then copy (and paste if needed) the scanned barcode value. Paste it somewhere such as a Google Doc. I recommend pasting it between other symbols such as # so that you can see if there are extra spaces, etc. For example, if you pasted " 2345" on a blank page, it might look the same as “2345” but if you use #s as bookends, it looks like this:
# 2345#
vs.
#2345#
Make sure the value there exactly matches the value in your data source.