# Replace string with image URL in data field

**URL:** <https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591>\
**Category:** Ask for Help\
**Created:** [August 11, 2024, 2:21pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591 "2024-08-11T14:21:44Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![BungaWunga\_Wunga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/bungawunga_wunga/32/78506_2.png) [@BungaWunga\_Wunga](https://community.glideapps.com/u/BungaWunga_Wunga)\
**Post date:** [August 11, 2024, 2:21pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/1 "2024-08-11T14:21:44Z")

</div>

I have some data fields that will use image as icons. Is there a way to use a smail string of text that will be replaced by the image html?

Template column will not work since data is different in each row.

Thanks again!

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [August 11, 2024, 2:28pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/2 "2024-08-11T14:28:10Z")

</div>

Why doesn’t the template column work? Can you provide a sketch or screenshot of what you want to achieve?

---

<div class="post-metadata">

**Author:** ![BungaWunga\_Wunga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/bungawunga_wunga/32/78506_2.png) [@BungaWunga\_Wunga](https://community.glideapps.com/u/BungaWunga_Wunga)\
**Post date:** [August 11, 2024, 3:26pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/3 "2024-08-11T15:26:08Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/3/5360a9e583d52a9315ab075248ff30b2decd0c6d.png)

Each line would be a different data row.

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [August 11, 2024, 3:31pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/4 "2024-08-11T15:31:09Z")

</div>

I think you need to use a custom collection component. You need to organize your data from the tabel editor side.

> **[Custom Collection | Glide Docs](https://www.glideapps.com/docs/essentials/components/collections/custom-collection)**
>
> Build dynamic, reusable collections of data with Custom Collections.

---

<div class="post-metadata">

**Author:** ![BungaWunga\_Wunga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/bungawunga_wunga/32/78506_2.png) [@BungaWunga\_Wunga](https://community.glideapps.com/u/BungaWunga_Wunga)\
**Post date:** [August 11, 2024, 3:52pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/5 "2024-08-11T15:52:15Z")

</div>

No, that wouldn’t work. My current data fields for the above example are something like this: Some text \<img src=“…”…\> some more text \<img src=“…”…\> \<img src = …"…\>.

What I would like to do is to write something like:

Some text {blue} some more text {black} {blue}

and make it replace {blue} and {black} for their respective ![]() tag.

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [August 11, 2024, 4:00pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/6 "2024-08-11T16:00:05Z")

</div>

Are you querying HTML code or do you want to replace data dynamically? I don’t understand what you mean.

---

<div class="post-metadata">

**Author:** ![BungaWunga\_Wunga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/bungawunga_wunga/32/78506_2.png) [@BungaWunga\_Wunga](https://community.glideapps.com/u/BungaWunga_Wunga)\
**Post date:** [August 11, 2024, 4:22pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/7 "2024-08-11T16:22:37Z")

</div>

I’m not querying. I just want to replace so I don’t need to have a loooong code in each cell. Sorry if I don’t make myself clear, I have almost none experience with coding.

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [August 11, 2024, 4:39pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/8 "2024-08-11T16:39:09Z")

</div>

If you want to replace, you need a template column to replace your image URL. Why do you say it doesn’t work?  
If you want each row to be different, you need a custom collection component as a list and add a richtext component to display the value of your template column in the form of HTML code. Here’s how it works.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [August 11, 2024, 6:58pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/9 "2024-08-11T18:58:54Z")

</div>

Template columns can also have dynamic template text. If you have a basic text column with the text layout in each row, then you can feed that into a template column and still set up your replacement values.

---

<div class="post-metadata">

**Author:** ![BungaWunga\_Wunga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/bungawunga_wunga/32/78506_2.png) [@BungaWunga\_Wunga](https://community.glideapps.com/u/BungaWunga_Wunga)\
**Post date:** [August 11, 2024, 8:58pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/10 "2024-08-11T20:58:02Z")

</div>

I’m probably doing something wrong.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/a/5a449d93da25bf1da6e13a8114d3139df63e2834.png)  
Here are my 2 columns. The first one has the text with {Blue} and {Black} strings to be replaced.

The second one is the template column, where the design is just the first column, but on replacements I have both {Blue} and {Black}.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/9/d998e0da302e170fd1e838a8cc2dac175854eae0.png)

Since this text is not addressed on the template design, it’s not replaced.

I don’t know how to do it in another way… If someone can explain in details, it would be awesome.

Thanks.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [August 11, 2024, 9:17pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/11 "2024-08-11T21:17:45Z")

</div>

You need to first point the Template value in the Template column directly at the Main column. Click the 3 dots to select the column. Then configure your Replacements to only replace Black and Blue. Main is your actual template, which can be different in each row. The template column just reads that template, and then takes care of the replacements.

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [August 11, 2024, 9:20pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/12 "2024-08-11T21:20:16Z")

</div>

![Screenshot 2024-08-12 at 04.11.03](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/0/a068f65ae4b1b4a56be20428c509971d722914c6.png)

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [August 11, 2024, 9:22pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/13 "2024-08-11T21:22:05Z")

</div>

Jeff, do you know the meaning of the piece of cake that appears next to my name? 😄

---

<div class="post-metadata">

**Author:** ![BungaWunga\_Wunga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/bungawunga_wunga/32/78506_2.png) [@BungaWunga\_Wunga](https://community.glideapps.com/u/BungaWunga_Wunga)\
**Post date:** [August 11, 2024, 9:25pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/14 "2024-08-11T21:25:37Z")

</div>

Found my error. Thanks to both of you @Jeff_Hager and @Himaladin !!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [August 11, 2024, 9:26pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/15 "2024-08-11T21:26:47Z")

</div>

> [@Himaladin](#):
>
> cake

It’s the anniversary of the day you registered in this community. August 12, 2020. 😉

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [August 18, 2024, 9:27pm UTC](https://community.glideapps.com/t/replace-string-with-image-url-in-data-field/75591/16 "2024-08-18T21:27:12Z")

</div>

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