Variable from a calculation shown in a html element

Dear App experts,

I would like to show the avg(Umsatz) of a table shown in my graphics in the middle in an html element to the right side (right there by the ‘Hallo’).
Currently I tried to create an extra datasource element for that to calculate the avg and then I tried to pass the value to the html element.

The graphic:

The code to compute the avg:

{
  "config": {
    "dataId": "5a6cc42b-22b6-4076-910c-7473b3e4f721",
    "dataOptions": {
      "$sql": {
        "value": "SELECT avg(UMSATZ_MIT_RABATT) as x from inputTable GROUP BY EINKAUFSSTAETTENNAME"
      },
      "sql": ""
    },
    "projectId": "6a5e729c-9c96-4f0f-85d5-f1c574c2c551",
    "schema": "table"
  }, 
  "id": "html_test_ds",
  "origin": "datatable"
}

The code for the html element:

{
  "config": {

  "values": [
    {
      "origin": "data",
      "column": "x",
      "row":0,
      "name": "Val1"
    }
  ],

    "html": "",
    "$html": {
      "value": "<div>Hallo {{Val1}} '{{filters.filter_firma_ele.HaendlerName.values.0}}'</div>",
      "type": "string"
    }
  },
  "id": "html_test_ele",
  "styles": {},

  "source": "html_test_ds",


  "type": "html"
}

But the value from the html_test_ds is not passed on to the html_test_ele.

Could someone give me a hint how I could make it happen? Any help would be great?

If I remember it correctly, it is not possible to combine two different kind of variables. So the variable that comes from the values property (Val1) cannot be combined with the ‘normal’ ones like the filters. So try to only use Val1 first.

In that case, you must add the filter value to the html_test_ds.

Hi Kai,
thank you for your reply again :slight_smile: But if I only use the Val1 variable, it is still not passed on to the html element :frowning:

Solved, thanks to Zölle :slight_smile:

{
  "id": "html_test_ele",
  "styles": {},
  "source": "renpen_ds",
  "type": "html",
  "sourceOptions": {
    "sql": "SELECT sum(i.UMSATZ_MIT_RABATT) as um from inputTable i GROUP BY i.EINKAUFSSTAETTENNAME, i.HaendlerName"
  },
  "config": {
    "values": [
      {
        "origin": "data",
        "column": "um",
        "row": 0,
        "name": "Val1"
      }
    ],
    "html": "<div> {{Val1}}</div>"
  }
}