Read Objects in Column A and Pulling Values in Column B

Exactly as title states, I’m trying to read a specific value in Column A, let’s say a specific color within the column of many colors. Then i want it to get the row id of ALL the cells that contains that color. After that it would pull the values from those rows but from Column B. This is what I’m “trying” to do currently

You need to loop through the values in Column A and if the cell value in the row at [loop count] (usually i or j) equals “novel” then add the value in Column B at [loop count] to a list.

Do not use the “first occurrence of” block. That’s only for single searches, not for loops.

You can see an example here: Performing a VLOOKUP in LocalDB

A bit new to this. but I tried this and didn’t work. Not sure where I went wrong? I also don’t really understand how the loop “for each item” block works

That looks good except that you set your loop count variable to 1 when it should have been 0. The first time through your loop, that variable gets set to 2 (1+1).

Also, you can’t set an image’s picture property to a list variable.

So how do I set the image picture to the image i pulled? I’m using Google Sheets with Cloudinary URL for my images

EDIT: I tried turning the image into an Object, but it also doesn’t work.

Take out the “get property of object block.” Just set image2’s picture to app variable randomBook.

But make sure you’re getting the value you expect. Assign that same variable to a label’s text so you can verify the image filename is correct.

Be careful about mixing variable types. When you initialize app variable randomBook as an object and then try to assign it a text string from your data source, it’s going to fail because a string is not an object.

Remove the “create object” block at the top of your screenshot. You do not have to give variables starting values (unless they are stored variables).

I think i did exactly as you said, removed the value from randomBook starting value, and just set the image/label directly to randomBook. Still not working? The label isn’t changing either

You’ll now need to do some debugging to see which part of your blocks is not working.

I recommend this method: Debugging in Thunkable X (Video)

It’s fixed now! That debugging block really helped. Though the problem was silly, apparently if you had empty cells in the column it’d break the code. So i had to just put “1” in the supposed to be empty cells and it just skips over them, works fine now. Thanks so much!

1 Like

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