cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdowns as input in SAC

ahfadoo
Participant
0 Kudos
1,083

Hello, I am currently working in dropdowns within SAC and I am attempting to utilize dropdowns as a manual input for users. I have successfully brought in various inputs from models into Stories via properties and dimension. Although, where I am currently stuck is I am unsure as to how to bring in hierarchies into these dropdowns. I wish to have a cascading dropdown(Dropdown 1 = Hierarchy lvl 1, Dropdown 2=  Hierarchy lvl 2). Can I get any help on this?

ahfadoo_0-1706514934643.png

This is how the parent Hierarchies look like(The ones I've brought in) and I wish to have the ability to break them down further. The code I have used for this is a simple getHierarchies() function. 

 

Any help at all would be greatly appreciated!

Accepted Solutions (0)

Answers (1)

Answers (1)

James_Barlow
Newcomer
0 Kudos

This may have been answered elsewhere, but i'm finding using the new community pages a total pain.

In the past I've used the approach of a hidden table that I pull dimension members from.
The table is filtered using the SetHierarchyLevel parameter.

The logic I used is below

Model:                   n/a
Dimension:           Geo
Table Name:         Table_1
Dropdown:           Dropdown_1

Script:  Most likely placed in the OnInitialization event for the dashboard.

Table_1.getDataSource().setHierarchyLevel("Geo",1);  //set Table_1 hierarchy to level 1 (Country)

var Geovals = Table_1.getDataSource().getResultSet(); //get the values returned in Table_1

for(var i=0;i<Geovals.length;i++){

                var id = Geovals[i]["Geo"].id;
                var description =  Geovals[i]["Geo"].description;
                Dropdown_1.addItem(id,description);        
               //Get the result set and restrict it to values for the Geo dimension, add the values to the dropdown list
}


ahfadoo
Participant
0 Kudos
Hello, I agree it's difficult to navigate around the new platform! And I have found a solution to this that is very similar to your answer. Although, my issue lies in the getResultSet() line. My table has no values whatsoever and I am trying to accomplish my initial goal without having any values in my measure. I put in sample data and tried to use the ResultSet function and it worked great but unfortunately that isn't my requirement. Is there any work around to this?