[Solved] Using VLookup in Airtable to display a picture

Hi,

I have an Airtable database with Exercise names and corresponding images.

2

Now when a particular exercise name comes up on screen, I want to display that image from the Airtable.
Theoretically, I am looping through the ExerciseName column and when a match happens, display that corresponding row in ExerciseGIF column.

However, I am not getting the picture on screen. Please help correct the blocks.

Susovan

1 Like

See this post!

1 Like

Hi Jared,

So I know how to get images from Airtable. If I specify the column and row, I am able to retrieve and display images. The following block is working since I know the exact row number.

However, my problem is about picking the image when the row number is dynamic. For example, when the name on screen is Squat, I should be able to retrieve the image of the Squat.

@Mark could you take a look at this? Any help will be appreciated.

Susovan

@thestrengthinstitute
Retrieve the column of exercises. Search through the returned list for the first occurrence of that exercise,

that is the row number

first
save the active exercise to a variable named tempActiveExercise

then
call airtable and get column ExerciseName, save this to a variable named allExerciseNames. now allExerciseNames is a list of all the cells (or exercises) in the column ExerciseName.

next

in list allExerciseNames, find the first occurence of tempActiveExercise

save this result to a variable named tempRowNumber

use tempRowNumber in your Airtable call to retrieve the image.

get cell
in row (tempRowNumber)
in column (“ExerciseGIF”)

then i reread the entire post so i made this

_remixThisProject

However, I am not getting the picture on screen. Please help correct the blocks.

Susovan,

I think the problem might be that you are specifying the rowNum as a text string (i.e. "i"). It needs to be the variable named ‘i’ instead. Do do that you should pull the variable block from the “Variables” drawer on left side of the Blocks Editor and use that instead. It will look something like:

Screen Shot 2020-05-18 at 11.51.00 AM

Hope this helps.

-Mark

1 Like

Amazing!!! That worked.

Thanks @jared

1 Like