Linking to external URLs by combining constant variable with cell value

While creating a table panel in grafana, I wanted to show the value of a certain row as a link to an external service.
In order to do this, I created a constant variable (lets call it $START_URL) containing the prefix I would like to append to the cell value to construct the complete value.
Next, I selected Visualization > Add column style > render value as link and added the following expression under Url: $START_URL${__cell}.

This doesn’t work as expected, since grafana appends its own domain to the front of this url.
However, the tooltip does show the right value.

Is there a workaround to achieve the correct link?
I have already seen the ${__cell:raw} syntax, but it doesn’t seem to work because of the extra $START_URL prefix.

I am experiencing this as well. I would like to be able to set the URL with a constant and append some cell values so the dashboard can be neatly exported and used by others without having to muck about in the JSON code (fun though that is).

How can we prevent Grafana som putting it’s own URL in front? Is there some redirect notation that could be used to let grafana redirect us out the the proper URL?

1 Like

Given the example above I think you can just do:

${START_URL:raw}${__cell}

Another alternative with the old (pre v7 table panel) is to render your link manually however you want using HTML tags and enable the Sanitize HTML option.

With v7 table panels you no longer have the Sanitize HTML option. You don’t seem to have to do the :raw but probably need to use ${__value.text} or one of the other variables instead of ${__cell}.

2 Likes

Aha!

Thank you. That did the trick!

In my case the result is (relevant JSON part):

“linkUrl”: “{OTRSURL:raw}?Action=AgentTicketZoom;TicketNumber={__cell};ArticleID=${__cell_1}”,

In the export it seemed to be VAR_OTRSURL, but seems it goes back to OTRSURL after import.
Sweet! Now to build a few more dashboards :wink:

Hi @cdnhaese - Would you be able to elaborate more on how you achieved this solution? I’m trying to do something similar in version 8.0.3 to show URL values as links to an external website. I don’t quite understand what you did to achieve this.

TIA!