Skip to Content
0

Is there a way to get filtered members?

Feb 16, 2017 at 01:22 PM

92

avatar image

I'm currently getting the members of a dimension using the getMembers function and passing them to an array, which works fine. However, once a user adds a filter, the getMembers function still returns all unfiltered members. Is there a function or a way to get only the filtered (shown) members into an array?

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Giulia Sogaro Feb 16, 2017 at 02:01 PM
1

Hi,

you can use the function DS.getFilterExt(“your_dimension”); or DS.getFilterText(“your_dimension”); .

Regards,

Giulia


Show 3 Share
10 |10000 characters needed characters left characters exceeded

Is there also a way to get a sorted result? This returns the items in the order they were clicked on when the user created the filter (instead of alphabetical order).

0

Hi,

you might try this workaround:

var filter = DS.getFilterText("dimension").split("; ");
var text = "";
var lov = DS.getMembers("dimension", 99);
lov.forEach(function(element, index) {
filter.forEach(function(element2, index2) {
if(element2 == element.text){
text = text + element2 + "; ";
}
});
});
TEXT_1.setText(text);

design studio writes the dimension members in alphabetical order, so I use that list to sort the filter list.

Regards,

Giulia

1

Perfect, thank you. I ended up doing something similar myself.

0