Thunkable and returns a corresponding value from my sheet

Hi. I am trying to do a search bar that would return a corresponding value to the item i searched in my google sheets. For example, column A in my sheets are names. when i searched “james”, it would return the value corresponding it in column B.
I have included a text_input, a label and a search_button. however, i have trouble creating the blocks for it. would appreciate if anyone could send some help.

The way to do this is to use the find first occurrence of List block (here) with the list of values block (in this section of the documentation) from your Data Source and assign that to a variable called something like foundRowNum.

Then Get Value from column B using foundRowNum as the row ID.

Here’s an example somewhat similar to what I mentioned: Creating a search engine - #18 by tatiang

2 Likes

im so sorry but how do i continue from here

Instead of using the does list contain block, use the find first occurrence of block.

You can see how to set that up in the link I provided above.

1 Like


is it something like this?

That will search the column “Name” in your data source for the Text Input’s text and store the row number in name1. To then get the value from the same row, put name1 into the “for row id” section of the get value block.

1 Like

thank you so much. you are so good at this

1 Like

How should I do if the user enter a person that is not in my google sheets?


But it doesnt work. pls advise

Avoid using the [gear list] block. The list of values block is already a list so you don’t need to use that extra list block.

1 Like

Thank you

how do i modify the code such that when a name is entered, it would take the best out of the 3 readings.
image


for example, if i search James, it would return 1.75.
if i search Alan, it would return 5.75.
however, if i search Mike who only has 1 reading, it will just give me 2.15 which is his most recent reading.

pls advise. thanks in advance

Set variable largestNum to 0
For j = 1 to number of rows in Data Source
      If Get value Name = target (e.g. "James")
         If Get value Final Timing > largestNum
            Set largestNum to Get value Final Timing


it doesnt work. am i doing it wrongly?

See this demo: Thunkable (first screen)

1 Like

thanks

by the way, is it possible to just search from the search bar directly instead of having a list? because if i have many people in my spreadsheet then it woould be difficult to go through the list itself

Sure, you can make the search function however you want. In the demo I created, I used the green “item” block that holds the name that the user clicked on. If you would rather have the user type in a name, just replace the “item” block with the text input’s text block.

im sorry, not really good at this.

heres what i have:



heres the link to my project
https://x.thunkable.com/copy/1d59b111e108aedc4a40706b7353aae5
im stuck. i wanted to do a search function whereby i am able to get a value which corresponds to their name. also, such that when a name is entered, it would take the best out of the 3 readings. if i search James, it would return 1.75. if i search Alan, it would return 5.75. however, if i search Mike who only has 1 reading, it will just give me 2.15 which is his most recent reading. its nice to have a list to show the people i have but a search input would be good so that its easier to look up

If you’re looking for someone to help you code, you’re welcome to contact me privately and I can share details about my consulting service. But I’m not able to offer more here beyond what I’ve already set up for you. If it’s a quick question, then sure but this involves re-working some of the blocks and it’s time I don’t have right now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.