Pass value to subcanvas parameter (script)

I have a dash with some buttons that unhide other dashboards in a subcanvas.

So when I click on the button to unhide a dash, I’d like to pass a value to a parameter IN that subcanvas’s dashboard.

I thought I knew how to do this, but even reading other posts here I don’t see one that addresses what I’m trying to do.

I’ve tried the classic script to assign a value, like this:

var view = this.parentView.control;
var state_ind_param = view.getViewParameterByName("parameter_name");
var new_value = dundas.context.currentSession.customAttributes[0].value.singleValue;

state_ind_param.parameterValue.clearTokens();
state_ind_param.parameterValue.clearValues();
state_ind_param.parameterValue.value = new_value;
state_ind_param.invalidateParameterValueLastModifiedTime();
state_ind_param.refreshAllAdapters();

It just cannot see the parameter on the subcanvas, so it fails. How do I make this work?

I believe you need to map a view parameter from the main canvas to the parameter on the dashboard inside the sub canvas.

example:
image

2 Likes

Thanks Renzi. I tried exactly that first but it didn’t work. My local parameter would populate, but the subcanvas one would not. I’m really not sure why. I can try again to see if maybe I misconfigured something.

Renzi was correct. I did not have an error in this part of the system, I had an error in that I was trying to set parameterValue.value on a parameter that was attached to a filter. My colleague reminded me that you must push a set of values to parameterValue.values and that worked on both the dash directly and when embedded into a subcanvas.

3 Likes