cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Reading Widget value to Edit script

Nazeer
8 - Cloud Apps
8 - Cloud Apps

Hi Team,

I am new here.

I am trying to read the value of a widget to the Edit script and trying to customize the widget based on data value.

For example, if I have an indicator or a smart label widget and could see a number or value in it. How can I use that value in the Edit script to customize widgets based on the value I get.

 

Naz

2 REPLIES 2

Alek_qbeeq
9 - Travel Pro
9 - Travel Pro

Hi @Nazeer,
For indicators you can use something like this:

widget.on('processresult', function (e, ev) {
	console.log(ev.result)
      console.log(e.indicatorInstance)
});

First console log will return basic informations like values, title, etc.
Second one will return more advance properties, like styling of each element.
Now, depending on what you would like to achive, you can use simple if statment and change for example font color of indicator label.

widget.on('processresult', function (e, ev) {
    var options = {
        title: {
            fontWeight: 'bold',
            color: 'green'
        }
    }

    if (ev.result.value.data > x) e.indicatorInstance.setOptions('numericSimple', options);

});

 
Alek

Ophir_Buchman
Sisense Team Member
Sisense Team Member

Hi @Nazeer,

Generally speaking, each widget processes information differently

Please refer to my KB article regarding customizing indicator widgets:
https://community.sisense.com/t5/knowledge/customizing-an-indicator-widget/ta-p/1770