I have a beautiful script that was created for us by Dundas (sorry I don’t know the author’s name) that we’ve been using to set the view of our dashboards to only show the current user’s information. The problem I’m running into is that it’s case sensitive and I can’t figure a way around it. Some of our users in the system have been added as ALLCAPS, others as all lower and others still as CamelCase. How can I alter this script to match username regardless of case?
// In a view's (e.g., dashboard's) ready or load actions, use this rather than this.parentView:
var viewParameter = this.control.getViewParameterByName("viewParameter1");
// Remove all values and tokens from the parameter value
viewParameter.parameterValue.clearTokens();
viewParameter.parameterValue.clearValues();
// Below is an example of a member value from a flat hierarchy.
// Create a new MemberValue to push onto the values array.
var memberValue = new dundas.data.MemberValue({
"hierarchyUniqueName": "Associate + Username",
"levelUniqueName": "Associate + Username",
"memberKind": dundas.data.MemberKind.REGULAR,
"uniqueName": dundas.context.currentSession.accountDisplayName + " (" + dundas.context.currentSession.accountName.split("\\")[1] + ")"
});
viewParameter.parameterValue.values.push(memberValue);
// Set the last modified time so this parameter takes precedence over any others
viewParameter.invalidateParameterValueLastModifiedTime();