Skip to content

Variables: Inconsistency in multi value variable interpolation + custom format #1321

@yesoreyeram

Description

@yesoreyeram

This issue is nothing to to do with the new sub property variable. This issue is just to highlight the inconsistency when handling multi value variable. As you can see in the below screenshot,

  • values of ${users} joined with ,
  • values of ${users:text} joined with +
  • values of ${users:value} joined with {,}

similar inconsistency followed when used with doublequote or any other custom formatter.

Image Image
Dashboard JSON
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "links": [],
  "panels": [
    {
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "code": {
          "language": "plaintext",
          "showLineNumbers": false,
          "showMiniMap": false
        },
        "content": "| Template  | Interpolated Value |\n|-----------|--------------------|\n| $\\{users} | ${users} |\n| $\\{users:text} | ${users:text} |\n| $\\{users:value} | ${users:value} |\n| $\\{users:doublequote} | ${users:doublequote} |\n| $\\{users:text:doublequote} | ${users:text:doublequote} |\n| $\\{users:value:doublequote} | ${users:value:doublequote} |\n",
        "mode": "markdown"
      },
      "pluginVersion": "12.4.0-20299387718.patch2",
      "title": "",
      "type": "text"
    }
  ],
  "preload": false,
  "schemaVersion": 42,
  "tags": [],
  "templating": {
    "list": [
      {
        "allowCustomValue": false,
        "current": {
          "text": [
            "foo",
            "bar"
          ],
          "value": [
            "foo",
            "bar"
          ]
        },
        "multi": true,
        "name": "users",
        "options": [],
        "query": "Mr.Foo : foo, Mrs.Bar : bar",
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "utc",
  "title": "New dashboard",
  "version": 0,
  "weekStart": ""
}
Details

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/variablesIssues related to variables system in scenestype/bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions