cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Json data as a variable in Dashboard

kmahali
Visitor

Is there a way to define a json data as variable, so that I can use in all the tiles as configuration data? It looks like code block as variable can only return a list. 
DavisAI suggested this code, but that throws an error

export default async function () {
  return [
    { "key1": "value1", "key2": "value2" },
    { "key1": "value3", "key2": "value4" }
  ];
}

 

The result of your code doesn't match the expected format. Please refine your code so that it returns a string or a list of strings like: ["green", "yellow", "blue", "purple"]

Even when I make the variable code to rerun an array like below, I am not able to access the values in the Tile code.

export default async function () {
  return ["data1", "data2"];
}

 

Below code returns 'val1'. If I access 1st item it gives the value 'v'

export default async function () {
  return  $Variable4   ;
}
0 REPLIES 0

Featured Posts