Change "Data Viewer List Image" based on a database value

Hello everyone! I am very new to Thunkable and I am trying to make an app that filters the possible actions in D&D.

For now the first problem I encountered trying to get this:

In the spell table I have a column (“classe”) dedicated to who those spells belong to (W = warlock - S = sorcerer).


I would like the warlock image to appear in the “Data Viewer List” or in the “Data Viewer Grid” when “W” is written in the corresponding column (and the same for the sorcerer’s image when there is “S”).

I know that the simplest thing would be to add a column with the link to the corresponding image in the database but I would like to learn this alternative as well.

I tried to search, maybe the wrong things, but I didn’t find how to make something happen based on the corresponding value written in a database column (in this case the check should be done for each row of each element).

ps. Warlock and Sorcerer images are uploaded into assets.

I hope I was clear enough and thanks everyone for the help.

1 Like

Basically, go through the records one by one checking the value of this column and based in the value update the image.

Great summary! Exactly what I want to do.

1 Like

Check this quick example

This is the sample table

This is the code to select the image for each row

1 Like

Thank you very much for helping! I have tried and it actually works.

If I understand the code correctly, the check it is doing is on the “Text” field of the “Data Viewer List” and not on the database.

This means that when I need to do the same thing but on an invisible database field / column this code would no longer work.

So would it be possible to do what I want on fields not recalled in the “Data Viewer List”?

Thanks again for the help.


This is not a problem. You can assign the column to control the image to the image of the Data Viewer List
This way you do not have to show the column in the Data Viewer

You will then need to change the code this way


Thanks again, surely this solution works too!

Even if you didn’t tell me directly, I deduce that there is no way to do this check directly on the database but that we need to recall the value in some field of the app, right?

ps. I don’t know why but even if the code is correct, it only worked the first time and then not anymore.

1 Like

No, this is not what I meant. You can actually go direct to the database.
You can do this which will go direct to the database

1 Like

Great thank you so much for your help. It was exactly what I was looking for!