0 votes
1 view

In a Custom Chart Widget, I need to get cockpit variables, and also if possible to set cockpit variables.

Can someone give me some hint, (using variablesController or any available attribute/function), to access cockpit variable in javascript from widget,

This is not documented for use in custom widget, but I suppose it's possible, just matter to find the right attributes/functions available in the document window object !

Thanks in advance for suggestions !

Environment Knowage version 7.4.5, with Docker, on macos
asked Aug 13, 2021 in Cockpit, Dashboard and Console by alaing (670 points) | 1 view
just to be updated...

waiting for help !
Eheh, leave me the time to answer ;)

1 Answer

+1 vote

Dear alalng,

you are right, they are accessible from within the cockpit but the information is a little hidden inside the documentation.
If you search "variables" paragraph in this documentation chapter  you should see how to reach them.

However you can just use the datastore.variables object to get the needed variable value.

Example:
var myCustomValue = datastore.variables.myCustomValue.

Hope it helps.

Regards

Davide

answered Aug 13, 2021 by redjaw (11,310 points)
Regarding setting the variables I suggest you this chapter:
https://knowage-suite.readthedocs.io/en/7.4/functionalities-guide/cockpit/index.html?highlight=variables#variables

Variables are not made to be modified during the execution but to be spreadily shared between the same cockpit.

Regards
Thanks a lot @redjaw, for your clear answer !
1,555 questions
1,017 answers
2,038 comments
2,568 users