# Different markdown value based on data from sql query

**URL:** <https://discuss.elastic.co/t/different-markdown-value-based-on-data-from-sql-query/277098>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [June 25, 2021, 6:52pm UTC](https://discuss.elastic.co/t/different-markdown-value-based-on-data-from-sql-query/277098 "2021-06-25T18:52:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![qlikq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/qlikq/32/90285_2.png) [@qlikq](https://discuss.elastic.co/u/qlikq)\
**Post date:** [June 25, 2021, 6:52pm UTC](https://discuss.elastic.co/t/different-markdown-value-based-on-data-from-sql-query/277098/1 "2021-06-25T18:52:08Z")

</div>

Could someone point me in right direction how to manipulate text in markdown component based on value that i am getting in data ? I have created it as

> filters
> 
> | essql query="SELECT 'dobry' AS "mojstatus""
> 
> | markdown
> 
> content={
> 
> string value = "{{rows.0.mojstatus}} "
> 
> value=" xx "
> 
> value=" aaa"
> 
> value = " zzz"
> 
> value = " xyz"
> 
> }
> 
> | render  
> I can display the 'dobry' value of my query in the markdown with string concatenation, now i would just need to change some other values based on the value of 'mojstatus', if it is equal to 'dobry' then next value should be xx, but if its 'zly' , then yy , for example  
> I am now stuck with how to apply compare or / if , i have been searching reading a lot, but still have not found the answer. I saw articles that use the mapColumn, but i don't even understand if i have to use this approach. I really would appreciate any pointers.

//edit  
I managed to get the displaying part, but i dont understand why the image is not displayed correctly when it hits the 'false' scenario. it just prints the base64 string and thats it, no image is loaded. the id is correct.

> filters
> 
> | essql query="SELECT 'zly' AS "mojstatus""
> 
> | markdown
> 
> content={
> 
> string value = "{{rows.0.mojstatus}} "
> 
> value=" xx "
> 
> value=" aaa"
> 
> value = " zzz"
> 
> value = " xyz"
> 
> value = {string "![My Image](" {if condition={getCell "mojstatus" | eq 'zly'} then={asset "asset-ae3daa35-22f8-4062-a7af-4190b679c9cf"} else={asset "asset-1759c798-20b2-455e-af7f-53f1016cbcc8"} } ")"}
> 
> }
> 
> | render

//edit  
looks like the second asset was corrupted from my side. I would still love to get some pointers if this cane be done better/if i am doing anything wrong,.

Thank you

---

<div class="post-metadata">

**Author:** ![Felix\_Roessel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felix_roessel/32/41623_2.png) [@Felix\_Roessel](https://discuss.elastic.co/u/Felix_Roessel)\
**Post date:** [June 26, 2021, 3:20pm UTC](https://discuss.elastic.co/t/different-markdown-value-based-on-data-from-sql-query/277098/2 "2021-06-26T15:20:24Z")

</div>

You are on the right track.  
Here you find some examples [https://elastic-content-share.eu/downloads/apm-services-overview-canvas/](https://elastic-content-share.eu/downloads/apm-services-overview-canvas/)

If you like to add an image to markdown you need to add a Link.

---

<div class="post-metadata">

**Author:** ![qlikq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/qlikq/32/90285_2.png) [@qlikq](https://discuss.elastic.co/u/qlikq)\
**Post date:** [June 29, 2021, 7:40am UTC](https://discuss.elastic.co/t/different-markdown-value-based-on-data-from-sql-query/277098/4 "2021-06-29T07:40:18Z")

</div>

Thank you Felix!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 27, 2021, 7:40am UTC](https://discuss.elastic.co/t/different-markdown-value-based-on-data-from-sql-query/277098/5 "2021-07-27T07:40:38Z")

</div>

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