So I definitely am working on my javascript skills, and am stuck on something that could be really obvious - I’m not sure!
The dashboard that I’m working on has a filter connected to a data input cube with results which are documented in connection with the user id of the end user logged in.
On page ready, I just want to grab the user id, clear the filter, and then enter the user id into my filter which is connected to my visualizations / etc so that the user just sees their own data.
I know that I’m almost there, and not sure what I need to do to update the filter. I’ve experimented with different things from the script library, this is what I have in there now…any ideas?:
//get Login ID
var currentLogin = dundas.context.currentSession.accountId;
console.log(currentLogin);
// Get the parent view.
var parentView = this.parentView;
// Get the view parameters.
var viewParameters =
parentView.control.viewParameters;
// Using the library, get the view parameter based on it’s name
var viewParameter =
this.parentView.control.getViewParameterByName(“viewParameter1”);
// Remove all values and tokens from the parameter value
viewParameter.parameterValue.clearTokens();
viewParameter.parameterValue.clearValues();
//this is where I’m stuck, the piece that is not working, and so after this I’m not really sure which pieces of code I need to add / remove / etc.
//set the value of view parameter to = the current Login ID
//viewParameter.parameterValue = currentLogin
// Load the member value.
currentLogin.loadMemberValue();
// Push the parameter value to the values list.
viewParameter.parameterValue.values.push(currentLogin);
// Sets the value of lastModifiedTime to now
viewParameter.invalidateParameterValueLastModifiedTime();
// Update all the connected adapters with the newly modified values
// Includes data visualizations and filter controls
viewParameter.refreshAllAdapters();