Hi all,
Trying to query my data source without having to use QueryVariable
function, and storing the results to be used to change behavior of panels and rows later on. However, I’m not a big fan of creating a template variable just for it to be hidden since it won’t be used by the dashboard users, only used for the behaviors.
So far I’ve got a QueryVariable
:
const exampleVariable= new QueryVariable({
name: 'exampleVar',
label: 'Example Variable',
datasource: { uid: dataSourceUID, type: myDatasource' },
query: "haystack {\n search(filter: \"site and geoCountry=~/$country/ and organizationRef==@$org\", limit: 0) {\n entity {\n tags(tagFilter: [\"geoState\"]) {\n templateVal:value\n }\n }\n }\n}",
refresh: 2,
sort: 1,
isMulti: true,
includeAll: true,
options: [],
hide: 0,
value: '$__all',
});
And I am able to print out the result via:
exampleVariable.getValueOptions({}).forEach((value) => {
console.log(`values`, value);
})
Is there a function I could use that queries my data source before a page loads, and potentially also refresh the values when the other template variables that drives this query changes?
Regards.