Assign value to variable directly from table

Dear App-Builders,

I am currently working with the progress-kpi and I would like to inject a variable value into config.kpiName.text. I know its possible to use variables with the {{}} syntax to do this, but what I don’t know is how to assign the variable value directly from a table.
For example in this case I would have a kpiTable and I would like to display one or two values from that table (given by row and column) in the text property of the progress-kpi.
Is it generally possible to point the source of a variable directly to a table and perhaps select the correct value with another SQL statement like its usually done using sourceOptions?

Thanks everyone!

Hi Johannes,
I think you could use the NavigationCell Custom Component.
It will render a little arrow on the implemented column.

image

It allows a property variablesToSet:

{ "variableName": "myGlobalVariable", "columnName": "column1" }

→ Clicking the rendered arrow will set the variable value to the value available in the specified column

For your use case (as I understood it) I suggest leaving the goToPage property empty… This will create the functionality to filter the other element by clicking the rendered arrow in the table.

1 Like

Thanks for you answer :slight_smile: . I can see how that would work, although I believe its not exactly what I need. I need the value to be loaded from the table directly, without any intermediate steps ( clicking somewhere). The values will also always be in a fixed location of the table, so I want to load them by default from a certain column and row.

There is an ugly workaround for that:
You can create a filter element that has a placement in your App Layout but is not visible (either it is behind another object with the z-index or you can hide it directly in flexgrid). You can choose the first value of the input table of the filter as default value, so ensure that the number you would like to visualize is the first entry in the source of the filter (e.g. using a smart customSQL). You can then use the variables from filter values feature (check out the docu if you don’t know it yet: <<your_instance>>/apps/apps-docs/odml-documentation/AppBuilder/global/Global.html#variables-from-filter-values to get the default value of the filter as variable. That variable can be used in the KPI element.
This workaround is sometimes a little bit unstable to in the App Builder. But if you reopen your Browser from time to time it should work.

1 Like