cancel
Showing results for 
Search instead for 
Did you mean: 

Change Filter in SAC table To Top 5/Bot 5 based on Drop down of TOP and BOT

RAMNATH
Discoverer
0 Kudos
314

Hi folks,

I am new to SAC and I have this requirement to filter Top 5 or Bot 5 contributors on a Measure but I want it to be driven through the Input field Dropdown with two values TOP 5 and BOT 5. when I select the values the Table_1 should have a particular Measure restricted to top 5 values or Bottom 5 values.

I think it is possible to do it via Scripting changing filters of table . Can someone help me on filters.

Regards

Ram

 

 

 

View Entire Topic
N1kh1l
Active Contributor

@RAMNATH 

Create the dropdown for TOP5 and BOT5. Read the value of this dropdown, and based on the value rank the table.

var sel = Dropdown_1.getselectedkey(); This will return what was selected in dropdown.

if (sel === "TOP5" ) {
Table.rankBy({
	applyToEachDimension: false,
	direction: Direction.Horizontal, // or Direction.Vertical
    rankOrder: RankOrder.Top,   // or RankOrder.bottom
    relatedDimensions: <dimname>,//put your dim name
	value: 5
});

Nikhil

thayumanavan
Participant
0 Kudos
Hi @N1kh1l
thayumanavan
Participant
0 Kudos

Hi @N1kh1l, In sac on initialization is used the below code but i am not able to mention the related dimension"invalid property related dimension : cannot convert from array; array dimension info to selection prototype"
var d = Table_5.getDataSource().getDimensions();
Table_5.rankBy({
applyToEachDimension: true,
direction: Direction.Horizontal, // or Direction.Vertical
rankOrder: RankOrder.Top, // or RankOrder.Bottom
relatedDimensions:{d}, // Use getDimension to reference the dimension
value: 1
});
I tried to add dimension it showing