# Value mapping for string not working

**URL:** <https://community.grafana.com/t/value-mapping-for-string-not-working/151724>\
**Category:** Dashboards\
**Created:** [June 1, 2025, 7:56pm UTC](https://community.grafana.com/t/value-mapping-for-string-not-working/151724 "2025-06-01T19:56:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luas](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@luas](https://community.grafana.com/u/luas)\
**Post date:** [June 1, 2025, 7:56pm UTC](https://community.grafana.com/t/value-mapping-for-string-not-working/151724/1 "2025-06-01T19:56:36Z")

</div>

- What Grafana version and what operating system are you using?  
Grafana 12.0.1 on Debian 12.11

- **What** are you trying to achieve?  
I’m reading a true/false value from InfluxDB. It’s _not_ boolean, but a string. I’d like to color-code this in state timeline, but it seems not to be recognized.  

As you can see here, a false condition is present from around 29th of May on. When pointing the mouse at it, it turns into a lighter green, and the legend points out true and false, both in green.

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/3/8/382e27b59704c38f562facded65b80eaad8864ee.png)

- **How** are you trying to achieve it?  
I tried to use several options in value mapping, but none seems to be applied:  

- What happened?  
True and False keep both shown as green.

- What did you **expect** to happen?  
I expect “false” condition to be shown in different colour.

- Can you copy/paste the configuration(s) that you are having problems with?

```auto
{
  "id": 10,
  "type": "state-timeline",
  "title": "Dachs 1",
  "gridPos": {
    "x": 15,
    "y": 7,
    "h": 3,
    "w": 3
  },
  "fieldConfig": {
    "defaults": {
      "custom": {
        "lineWidth": 0,
        "fillOpacity": 70,
        "spanNulls": false,
        "insertNulls": false,
        "hideFrom": {
          "tooltip": false,
          "viz": false,
          "legend": false
        },
        "axisPlacement": "auto"
      },
      "color": {
        "mode": "thresholds"
      },
      "mappings": [
        {
          "type": "value",
          "options": {
            "\"false\"": {
              "index": 0,
              "text": "test",
              "color": "red"
            },
            "false": {
              "index": 1,
              "text": "test",
              "color": "red"
            }
          }
        },
        {
          "type": "special",
          "options": {
            "match": "false",
            "result": {
              "color": "red",
              "text": "test",
              "index": 2
            }
          }
        }
      ],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          }
        ]
      }
    },
    "overrides": []
  },
  "pluginVersion": "12.0.1",
  "targets": [
    {
      "alias": "Dachs1",
      "datasource": {
        "type": "influxdb",
        "uid": "cfe3660c-5657-4b9f-8e3a-1334241171bb"
      },
      "groupBy": [],
      "measurement": "parser.0.BHKWs.Dachs1_laeuft",
      "orderByTime": "ASC",
      "policy": "default",
      "query": "SELECT \"value\" FROM \"parser.0.BHKWs.Dachs1_laeuft\" WHERE time > now() - 1h",
      "rawQuery": false,
      "refId": "A",
      "resultFormat": "time_series",
      "select": [
        [
          {
            "params": [
              "value"
            ],
            "type": "field"
          }
        ]
      ],
      "tags": []
    }
  ],
  "datasource": {
    "type": "influxdb",
    "uid": "cfe3660c-5657-4b9f-8e3a-1334241171bb"
  },
  "options": {
    "mergeValues": true,
    "showValue": "auto",
    "alignValue": "left",
    "rowHeight": 0.9,
    "legend": {
      "showLegend": true,
      "displayMode": "list",
      "placement": "bottom"
    },
    "tooltip": {
      "mode": "single",
      "sort": "none",
      "hideZeros": false
    }
  }
}

```

- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us **exactly** what they were.  
Not aware of, no.

- Did you follow any online instructions? If so, what is the URL?  
I checked the other results on Grafana Community for “value mapping not working”, but without success.

Thanks for any hint!

---

<div class="post-metadata">

**Author:** ![infofcc3](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/infofcc3/32/51248_2.png) [@infofcc3](https://community.grafana.com/u/infofcc3)\
**Post date:** [June 2, 2025, 4:58am UTC](https://community.grafana.com/t/value-mapping-for-string-not-working/151724/2 "2025-06-02T04:58:15Z")

</div>

![image](https://us1.discourse-cdn.com/grafana/original/3X/b/3/b38080882b7f6ec62c4ed59ae600cd4448edfb5e.png)  
 ![image](https://us1.discourse-cdn.com/grafana/original/3X/9/9/99db1ff2cf8cf0fba51bfa7136593f9761e0b05c.png)  
i am simply value mappings and it is work for me please check your panel configuration.

---

<div class="post-metadata">

**Author:** ![luas](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@luas](https://community.grafana.com/u/luas)\
**Post date:** [June 2, 2025, 1:47pm UTC](https://community.grafana.com/t/value-mapping-for-string-not-working/151724/3 "2025-06-02T13:47:27Z")

</div>

This is what I’m trying to achieve, yes.  
Well, it looks you did the exact same thing as I, and it works in your setup. However, just saying “check your configuration” is not of much help, as I did this extensively before opening a thread. No offense!

I’m still hoping for a hint what in my source data is different from yours (I guess this is where the problem begins). Is there a way to do a deeper check on source data, apart from table view? To find out which data type this is in InfluxDB, for example?

---

<div class="post-metadata">

**Author:** ![infofcc3](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/infofcc3/32/51248_2.png) [@infofcc3](https://community.grafana.com/u/infofcc3)\
**Post date:** [June 3, 2025, 4:08am UTC](https://community.grafana.com/t/value-mapping-for-string-not-working/151724/4 "2025-06-03T04:08:40Z")

</div>

i am using postgresql using this i can achive your requirement.

---

<div class="post-metadata">

**Author:** ![luas](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@luas](https://community.grafana.com/u/luas)\
**Post date:** [June 9, 2025, 8:10pm UTC](https://community.grafana.com/t/value-mapping-for-string-not-working/151724/5 "2025-06-09T20:10:37Z")

</div>

Don’t ask why, but I fixed the issue by doing a transformation. “Convert field type”, Convert as “other”.

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/0/b/0b956f7191968f4d8c2c0859dda5c1684b995042.png)  
Thanks for your effort!
