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

**URL:** https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319
**Category:** Questions about Thunkable X
**Tags:** solved, beginner
**Created:** [July 24, 2021, 12:26am UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319 "2021-07-24T00:26:51Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![MrMikk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mrmikk/32/111441_2.png) [@MrMikk](https://community.thunkable.com/u/MrMikk)
#### Post date: [July 24, 2021, 12:26am UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/1 "2021-07-24T00:26:51Z")

</div>

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).

![1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/467bba2a97fb6cc2dbbcde35ca8f3f1c86c6fe1d.jpeg)

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”).

 ![2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/f/dfad32c683503dea646ee5995384d62c055686bd.jpeg)

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.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 24, 2021, 3:16am UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/2 "2021-07-24T03:16:42Z")

</div>

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

---

<div class="post-metadata">

### Author: ![MrMikk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mrmikk/32/111441_2.png) [@MrMikk](https://community.thunkable.com/u/MrMikk)
#### Post date: [July 24, 2021, 6:12pm UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/3 "2021-07-24T18:12:08Z")

</div>

Great summary! Exactly what I want to do.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 24, 2021, 6:33pm UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/4 "2021-07-24T18:33:11Z")

</div>

Check this quick example

[https://x.thunkable.com/projectPage/60fc59ca749a2500116bf326](https://x.thunkable.com/projectPage/60fc59ca749a2500116bf326)

This is the sample table  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/5/95a39ddf830f45725dfb40fc7c4161bf93ad7857.png)

This is the code to select the image for each row

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/2/7266c43326077ef7ce6c01bb9cb7b5c1abd529c4.png)

---

<div class="post-metadata">

### Author: ![MrMikk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mrmikk/32/111441_2.png) [@MrMikk](https://community.thunkable.com/u/MrMikk)
#### Post date: [July 25, 2021, 12:40am UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/5 "2021-07-25T00:40:32Z")

</div>

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.

 ![3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/b/eb6143c24443dd86f84db301c8de5f5ed8913791.jpeg)

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.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 25, 2021, 8:02am UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/6 "2021-07-25T08:02:05Z")

</div>

This is not a problem. You can assign the column to control the image to the image of the Data Viewer List  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/8/38162aa546bf04207bfd23291abf3fe42b91aabe.png)  
This way you do not have to show the column in the Data Viewer

You will then need to change the code this way

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/4/746e09fe8059f8b9b78d25a4ab29571bd9c407e3.png)

---

<div class="post-metadata">

### Author: ![MrMikk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mrmikk/32/111441_2.png) [@MrMikk](https://community.thunkable.com/u/MrMikk)
#### Post date: [July 26, 2021, 11:00pm UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/7 "2021-07-26T23:00:08Z")

</div>

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.

[https://x.thunkable.com/copy/37cec663a1d7e7cb43775431536e3d3c](https://x.thunkable.com/copy/37cec663a1d7e7cb43775431536e3d3c)

 ![2021-07-27 00_54_47-Thunkable e altre 31 pagine - Personale - Microsoft​ Edge](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/9/99b6efd6e107ac17d0c43e72c5165f57d601c10f.jpeg)

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 27, 2021, 8:06am UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/8 "2021-07-27T08:06:32Z")

</div>

> [@MrMikk](#):
>
> there is no way to do this check directly on the database

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/2/024a041dd4277b7dd4f23fd2c409ec0d27e10a4f.png)

---

<div class="post-metadata">

### Author: ![MrMikk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mrmikk/32/111441_2.png) [@MrMikk](https://community.thunkable.com/u/MrMikk)
#### Post date: [July 28, 2021, 12:05am UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/9 "2021-07-28T00:05:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:17pm UTC](https://community.thunkable.com/t/change-data-viewer-list-image-based-on-a-database-value/1411319/10 "2024-11-08T13:17:49Z")

</div>


