cancel
Showing results for 
Search instead for 
Did you mean: 

Onclick button with reference to various global scripts

Former Member
0 Kudos

Hi All,

I am working on following scenarios.

I have a dashboard with KPIs with various tabs. Each KPI is linked to onlick button which refresh a chart.

Each onclick should be linked to all existing global scripts and depending on which tab we are navigating on refreshing the graph.I have the onlick pointing only on one global script and it is working.

I would like for each onclick button to refer an various global scripts by checking the tab on which is opened.

This is working:

gv_titre ='actual';

GLOBAL_SCRIPTS_1.tabolt();

I would like to write something similar to this:

gv_titre ='actual';

if(gv_Tab == 'tab1') {

GLOBAL_SCRIPTS_1.tabolt();

}

else if(gv_titre == 'tab2') {

GLOBAL_SCRIPTS_1.taboltet();

etc

Basile

Accepted Solutions (0)

Answers (1)

Answers (1)

MustafaBensan
Active Contributor
0 Kudos

Hi Basile,

Your requirement is not entirely clear.  Can you provide the script content for GLOBAL_SCRIPTS_1.tabolt() ?

If all you want to do is refresh the data source for a chart based on the selected tab then you should add a data source parameter to the GLOBAL_SCRIPTS_1.tabolt() function and pass the relevant data source via an if then statement in the On Click script of the tabstrip component.

Regards,

Mustafa.

Former Member
0 Kudos

Hello Mustafa,


Thank you for replying.

I have created one layout for my application and populating result via text strings.

The idea is for each KPI (e.g TEXT_xx) by clicking on it, it should refer to the right global script and update the chart.
The update of chart is working if I have only one global script in my event. I would like to have conditions which depending on which tab we are by clicking point to the correct global script.
I was thinking about an if  else statement.

Two of my global scripts look like this for e.g:

GLOBAL_SCRIPTS_1.tabolt();

if(gv_tab == 'tab1')

{

DS_1.clearFilter("xxxx");

DS_1.setFilter("xxxx");

//KPI1

TEXT_xx.setText(DS_1.getDataAsString("xxxx"}));

//KPI2

TEXT_xx.setText(DS_1.getDataAsString("xxxx"}));

//KPI3

TEXT_xx.setText(DS_1.getDataAsString("xxxx”

GLOBAL_SCRIPTS_1.taboltet();

if(gv_tab == 'tab2')

{

DS_1.clearFilter("xxxx");

DS_1.setFilter("xxxx");

//KPI1

TEXT_xx.setText(DS_1.getDataAsString("xxxx"}));

//KPI2

TEXT_xx.setText(DS_1.getDataAsString("xxxx"}));

//KPI3

TEXT_xx.setText(DS_1.getDataAsString("xxxx”


Thanks for helping.


Basile

Former Member
0 Kudos

Hi Basile,

Why do you need two Global scripts, if you can put the If-else within the Global scripts they should work fine.

Regards,

Fazith Ali Z

MustafaBensan
Active Contributor
0 Kudos

Hi Basile,

Like Fazith, I'd like to know why you need two global scripts?  Except for the if condition they look identical. 

To help clarify your requirements further I have the following questions:

1.  Based on the sample Global Script Functions, it looks like you are using only one data source for each of the charts.  Is that right?

2.  You refer to "tabs" in your question.  Are you actually using the Tabstrip component or are you simulating tabs using multiple Text components placed side by side?

3.  Are you using one chart and changing the data selections based on the selected "tab" or do you have a separate chart component for each "tab"?

Regards,

Mustafa.

Former Member
0 Kudos

Hello Mustafa,

thank you for replying.

1. I am using two data sources for each linked to one chart. I missed to insert it. The infochart referencing to the second datasource is not getting populated. Hier is the code (


DS_2.clearAllFilters();

DS_2.setFilter(xxxx);

INFOCHART_1.setDataSource(DS_2);

INFOCHART_1.setDataSelection();

)

2.  I am simulating tabs using multiple Text components placed side by side?

3.  I am using one chart and changing the data selections based on the selected "tab"  or the selected KPI

Thanks for helping.

Basile

Former Member
0 Kudos

Hi All,

thank you for replying.

I solved it by using the if else condition and refering to the global script. Additionally to that i have created more text boxes for KPIs.

Thanks

Basile