cancel
Showing results for 
Search instead for 
Did you mean: 

getMembers() limitation

0 Kudos

All,

I have noticed that if I set a filter on a dimension (we are using Bex queries), if I use the getMembers() function on the field that has a filter set, the getMembers() function returns a list of values that does not take the filter into account.

Example:

The script for a checkbox group that acts as a dimension filter is:

DS_1.setFilter("ZBO_STDNT", me.getSelectedValues());

After filtering values via interacting with the checkbox group, the getMembers script listed below returns a list that includes the values that were filtered out.

var Students=DS_1.getMembers("ZBO_STDNT", 10000000);

Has anyone else encountered this behavior, and have you found a solution?

To address a potential question that I have seen posed in other discussions that relate to this function, I have verified that both the query and the Initial view are set to "Posted Values" for filtering.

Thanks,

Scott

Accepted Solutions (1)

Accepted Solutions (1)

MustafaBensan
Active Contributor
0 Kudos

Hi Scott,

I have encountered this behaviour also and have just reproduced it to confirm.  My observation is that getMembers() only returns cascaded filter values based on filters applied on dimensions OTHER THAN the dimension specified in the getMembers() parameter.  So in your example, if you have another dimension in the data source and swap that out for dimension ZBO_STDNT in your getMembers() statement, you should notice that this time you do get the members based on the filtered values.  I guess this behaviour is by design.

I'm not aware of an approach to achieve your requirement with standard functionality.  Perhaps others may have ideas.  However, you can definitely achieve your requirement using the Data Iterator Component by from the SCN Design Studio SDK Development Community.

The steps are as follows:

1.  Ensure that the ZBO_STDNT dimension is included in the rows panel of your data source Initial View;


2.  As an example, apply the following code in the "On Data Change" event script of the Data Iterator to populate a List Box with the filtered members of the dimension:


var Students = DATAITERATOR_1.getRows();

myMembers.forEach(function(element, index) {

LISTBOX_1.addItem(element.getDimensionValueKey("ZBO_STDNT"), element.getDimensionValueText("ZBO_STDNT"));

});

Regards,

Mustafa.

Answers (1)

Answers (1)

michael_simon4
Participant
0 Kudos

Hi Scott,

an explanation for this behaviour can be found here:

https://wiki.scn.sap.com/wiki/display/BOBJ/Member+access+modes+and+returned+list+of+values+in+Design...

Quote: "Special case: Even if read mode Q is used, filters, which are set on the dimension for which getMemberList is executed, are ignored! They do not restrict the returned list of members for being able to change filters again. This is by design."

One addition: To avoid this behaviour we restricted the characteristic via variable (setVariableValue). This works in our case, but be aware, that this could have a performance impact, because the query needs to be loaded anew.

Best regards,

Michael

Message was edited by: Michael Simon

0 Kudos

Thanks to both of you! This explains the behavior very well.  I think for now, I don't need to pursue the SDK option, but it's good to know it's out there.  I primarily have just been testing to make sure that I understand the full behavior of getMembers before I use it in any application of significant scale. 

Thanks again.

Scott