Skip to content

Populating and setting a variable's current value #165

@jstaffans-relex

Description

@jstaffans-relex

Hi and thanks for the work on making grafonnet better aligned with the development of Grafana!

I have been playing around with the 10.2.0 API and Grafana 10.2.3 and now have the following variable definition:

{ 
  abc:
    var.custom.new('abc', values=['true', 'false', 'limited'])
    + var.custom.generalOptions.withLabel('Abc?')
    + var.custom.generalOptions.withCurrent('false')
    + var.custom.selectionOptions.withMulti(false)
    + var.custom.selectionOptions.withIncludeAll()
}

However, the variable's current value remains "true" despite the withCurrent('false'). How do I influence the variable's current (default) value?

Also, how do I make the default value "All"?

And finally, query type variables do not seem to populate as expected. After uploading a dashboard definition including the use of query variables, I need to manually go and click Run query in the Grafana variable editor UI to populate values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions