on 11-04-2014 3:11 PM
Hi,
I have requirement need to Trigger Datasources based on Selector(Combox having:13 days,YTD,13 Weeks).
I have created 3 Data Sources which is for 13 days,YTD,13 Weeks
I need to trigger 13 days when I select 13 days from combobox,similarly if I select 13 weeks need to trigger 13 Weeks Datasource,etc..
Please help me.
Thanks,
Prasad
Hi Prasad,
Assuming that your data sources are labelled "DS_13DAYS","DS_YTD" and "DS_13WEEKS", you will have to incorporate the following code into the "onSelect" event of your dropdown menu:
var Selected_Option = DROPDOWN_1.getSelectedValue();
if(Selected_Option == "13 Days")
{
DS_13DAYS.loadDataSource();
}
else if(Selected_Option == "YTD")
{
DS_YTD.loadDataSource();
}
else
{
DS_13WEEKS.loadDataSource();
}
Also, ensure that the "load in script" property for these data sources are set to "true" during design time. You could also use a global variable as a flag to check if a data source has already been loaded, as a further enhancement to this code.
I hope this helps.
Thanks and Regards,
Eshwar Prasanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prasad,
To achieve this functionality, you will only have to use only 1 data source and change the queries that you have bound the data source to dynamically at run time (Data source bound to a chart cannot be changed at run time). Here's a sample, to be implemented in the "onSelect()" event of your dropdown - assuming that data source "DW_SWITCH" is bound to your chart:
var Selected_Option = DROPDOWN_1.getSelectedValue();
if(Selected_Option == "13 Days")
{
DS_SWITCH.assignDataSource("cuid:ARZelWdoCTlDkY.nFZRRlM4", DataSourceType.QUERY, "ZDS_EXERCISE_01");
}
else if(Selected_Option == "YTD")
{
DS_SWITCH.assignDataSource("cuid:ARZelWdoCTlDkY.nFZRRlM4", DataSourceType.QUERY, "ZDS_EXERCISE_03");
}
else
{
DS_SWITCH.assignDataSource("cuid:ARZelWdoCTlDkY.nFZRRlM4", DataSourceType.QUERY, "ZDS_EXERCISE_04");
}
Here, the syntax for the method "assignDataSource()" is as follows:
DS_SWITCH.assignDataSource("<Name of the system you are connecting to>", DataSourceType.QUERY, "<Technical name of the query you want to use>");
The name of the system can be obtained using content assistance (Ctrl + Space) inside the script window.
Thanks and Regards,
Eshwar
User | Count |
---|---|
77 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.