cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Populate table and chart based on dropdown selection

0 Likes
3,876

Hello Community,

I am currently working on an SAP SAC analytical application that involves a dimension called BPP, which has properties such as Brand, Category, Package, and more. I have a dropdown that includes specific properties of BPP, such as Brand and Category.

My goal is to dynamically populate the table and chart with brand members when a brand is selected in the dropdown. I am seeking an SAP SAC analytical application script for this query.

Thank you in advance for your help.

Regards,

Pooja.

View Entire Topic
N1kh1l
Active Contributor

pooja.elangovan01

Thanks for clarifying your requirement. Below is the solution yo can approach.

Step 1 : Create a dropdown with attribute ID and description. As you are only using handful of attributes you can populate them manually. Please ensure that ID in dropdown is same as Dimension attribute ID. I have added only 2 attributes but you can add more on same lines.

Step2: Add a table and chart with attribute on rows and your desired measure on columns. I have kept brands on rows.

Now go to the On select event of the dropdown created in step 1 and add the below code.

var sel_attribute=DD_Attributes.getSelectedKey(); // reads the current dropdowm selection
var dim_rows = Table_1.getDimensionsOnRows();    // gets the current dimenions on rows in Table
var fp = "SAP_CEP_PRODUCT."+ sel_attribute;     // creates the pattern for parameter to be used later
var dim_ctr_axis =Chart_1.getDimensions(Feed.CategoryAxis); //gets the current dimenions on rows in Chart


//-- Remove all dimensions on rows in table
for(var i=0;i<dim_rows.length; i++) 
{
Table_1.removeDimension(dim_rows[i]);
}
//--

//-- Add the dropdown selected attribute to the rows

Table_1.addDimensionToRows(fp);

//-- Remove all dimensions on rows in chart
for(var j=0;j<dim_ctr_axis.length; j++) 
{
Chart_1.removeDimension(dim_ctr_axis[j],Feed.CategoryAxis);
}


//-- Add the dropdown selected attribute to the chart


Chart_1.addDimension(fp,Feed.CategoryAxis);

Output: When dropdown says Brand

When dropdown says Category

Hope this helps !!

Please upvote/accept if this helps you

Nikhil