Hi Experts,
I have added two widgets (Dropdown filter ) in my Analytical Application say - Customer Type and Customer ID.
My requirement is when I select Customer type say "ABC" then all the customer ID related to "Customer type = ABC" should only be visible to me in the dropdown filter - Custonmer ID. Please let me know how to achieve it.
Below is the current implementation done by me but i am not able to do cascading effect.
Currently I have initialized both the dropdown filters in onInialization() method of Canvas to fill it with master data available in backend.
onInitailzation() Method : To fill dropdown filters with master data
For Customer Type:
var i=0;
var customerType = Chart_1.getDataSource().getMembers("Customer_Type");
for (i=0;i< customerType.length; i++) {
dropdown1.addItem(customerType[i].id,customerType[i].description);
}
For Customer ID:
var j=0;
var customerID = Chart_1.getDataSource().getMembers("Customer_ID");
for (j=0;j< customerID.length; j++) {
dropdown2.addItem(customerID[i].id,customerID[j].description);
}
And then I added a code in dropdown filter onSelect() method to pass the selected key by the user to the global variable VAR_CUSTOMER_TYPE and VAR_CUSTOMER_ID.
onSelect() method Dropdown 1 and Dropdown 2:
VAR_CUSTOMER_ID = dropdown_1.getSelectedKey();
VAR_CUSTOMER_TYPE = dropdown_2.getSelectedKey();
And in the last , I created a button - Apply Filter and on click of that applying filters to all charts :
Chart_1.getDataSource().setDimensionFilter("dropdown_1",VAR_CUSTOMER_ID);
Chart_1.getDataSource().setDimensionFilter("dropdown_2",VAR_CUSTOMER_TYPE);
Chart_2.getDataSource().setDimensionFilter("dropdown_1",VAR_CUSTOMER_ID);
Chart_2.getDataSource().setDimensionFilter("dropdown_2",VAR_CUSTOMER_TYPE);