Hi Daniel,
You can try the below mentioned script:
// Get the parent view.
var parentView = this.parentView;
// Get the view parameters.
var viewParameter = parentView.control.viewParameters;
// Using the library, get the view parameter based on it's name --this.parentView.
var viewParameter = this.parentView.control.getViewParameterByName("viewParameter2");
//Build the member value
var myMemberValue = new dundas.data.MemberValue({
"hierarchyUniqueName": "<Name of your hierarchy>",//This will be the name of your hierarchy
"levelUniqueName": "<Name of your level>",//This will be the name of your hierarchy
"memberKind": "Regular",
"uniqueName": "<Value - In this case TRUE>.<Name of your hierarchy>" //This will be the name of your hierarchy
});
viewParameter.parameterValue.clearTokens();
viewParameter.parameterValue.clearValues();
viewParameter.parameterValue.values.push(myMemberValue);
viewParameter.invalidateParameterValueLastModifiedTime();
viewParameter.refreshAllAdapters();
The problem with the script that you are trying to use is the method of assigning values to the filter in your second last line. The section in the below mentioned support article specifies that to assign a value to a filter we will need to create a script like the one above (var myMemberValue = new dundas.data.MemberValue):
https://www.dundas.com/support/support-center/support-articles/scripting/modify-a-filter-/-view-parameter-using-scripting#h5-4-collectionmember
You will also need to clear token (viewParameter.parameterValue.clearValues()) along with values before pushing the new value to the filter and will also need to invalidate the filter’s last modified time after pushing the value to make sure the new value is reflected (viewParameter.invalidateParameterValueLastModifiedTime()).
You will also need to add the values to the "<Name of your hierarchy>" and <Name of your level> by checking its values in the chrome development tool:
https://www.dundas.com/support/support-center/support-articles/scripting/writing-scripts-using-browser-developer-tools
I hope this helps. :-)