# To convert the Integers into a String

**URL:** <https://discuss.elastic.co/t/to-convert-the-integers-into-a-string/311936>\
**Category:** Kibana\
**Created:** [August 11, 2022, 2:24pm UTC](https://discuss.elastic.co/t/to-convert-the-integers-into-a-string/311936 "2022-08-11T14:24:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [August 11, 2022, 6:39pm UTC](https://discuss.elastic.co/t/to-convert-the-integers-into-a-string/311936/2 "2022-08-11T18:39:04Z")

</div>

Hi @Maruthappan_Muthu

What version are you on?

There are a number of ways to do this but if you just want to see this in Kibana Visualizations and dashboards the easiest way is to add a runtime field to the the Index Pattern / Data View  
(you could add it to the actual mapping at some point if you want) Read on [runtime fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime.html)

Go To Stack Management -\> Index / Pattern or Data View depending on the version

Add Field

Here is the sample code...replace with your field names etc...

```auto
def status = doc['snmp_status'].value;
if (status != null ) {
    if (status == 1 ) {
        emit ("open");
        return;
    }
    else {
        emit ("closed");
        return;
    }
}
emit("Unknown");

```

 ![Screen Shot 2022-08-11 at 12.35.47 PM](https://us1.discourse-cdn.com/elastic/original/3X/e/e/ee5bb68261eec1dc9f54de9fdb43076367cb5202.png)

Discover ... and it will work in other Visulazations like Lens etc.

 ![Screen Shot 2022-08-11 at 12.37.05 PM](https://us1.discourse-cdn.com/elastic/original/3X/4/1/419dd553e433da367ff4623783308d985d6b3b9c.png)

---

_[View the full topic](https://discuss.elastic.co/t/to-convert-the-integers-into-a-string/311936)._
