Hi Grafana Community,
I am using variables in my Grafana Dashboard, but I need to perform some logic within these variables. Specifically, I need to take another defined variable, $cluster
, parse it, and based on the parsed values, perform some conditional logic using if
and else
.
For instance, I am looking for functionality similar to the following:
function parseAndEvaluate($cluster) {
// Parse the variable to an integer
// $cluster is another Grafana variable
let parsedNumber = parseInt($cluster, 10);
let result;
// Use the result in an if-else statement
if (!isNaN(parsedNumber)) {
if (parsedNumber > 50) {
result = "The number is greater than 50.";
} else {
result = "The number is 50 or less.";
}
} else {
result = "The input is not a valid number.";
}
return result;
}
Is the above possible in Grafana? If not, is there any ongoing work to provide such variable functionality? How can we request Grafana to support such functions?
Thank you for your assistance.