Working with View Parameters
This applies to: Managed Dashboards, Managed Reports
View Parameters in the Symphony embed library are defined the same way they would be defined via the query string. The following example sets a view parameter to a value and then loads the embedded application.
var dundasBIUrl = 'https://placeholder.dundas-bi-url.com/';
document.addEventListener("DOMContentLoaded", function (event) {
// *****************************************************************************
// It is usually best practice to get the logon token at the server.
// Credentials should not be specified directly in script unless they should be
// freely available to users.
// *****************************************************************************
dundas.embed.logon.getLogonToken(
dundasBIUrl,
{
"accountName": "viewer",
"password": "1234",
"isWindowsLogOn": true
},
function(getLogOnTokenResultData) {
var dundasApp = dundas.embed.create(
document.getElementById('dundasBI2'),
{
dundasBIUrl: dundasBIUrl,
controllerType: dundas.embed.ControllerType.DASHBOARD,
fileSystemId: 'f22ce55f-04cd-4207-9dd7-2cadeb44b96c',
logonTokenId: getLogOnTokenResultData.logOnToken
});
dundasApp.parameterValues = [
// The object is created by passing the name,
// and then the value formatted in the same way
// that would be defined via the query string
new dundas.embed.ParameterValue(
// The name of the view parameter
"viewParameter2",
// The value formatted to be passed in the
// same way as if was passed via query string.
"!" + 25000 + "~" + dundas.embed.tokens.basic.OPEN_RANGE
)
];
dundasApp.load();
}
);
});
Note:
For more information, see Pass parameter values via query string.
Token Helpers
For convenience purposes, token helpers have been added that can be used in the values of the ParameterValue
object.
Basic
dundas.embed.tokens.basic.ALL
dundas.embed.tokens.basic.DEFAULT
dundas.embed.tokens.basic.NO_SELECTION
dundas.embed.tokens.basic.NULL
dundas.embed.tokens.basic.OPEN_RANGE
SingleDate
dundas.embed.tokens.SingleDate.BEGINNING_OF_CURRENT_DAY
dundas.embed.tokens.SingleDate.BEGINNING_OF_CURRENT_MONTH
dundas.embed.tokens.SingleDate.BEGINNING_OF_CURRENT_QUARTER
dundas.embed.tokens.SingleDate.BEGINNING_OF_CURRENT_WEEK
dundas.embed.tokens.SingleDate.BEGINNING_OF_CURRENT_YEAR
dundas.embed.tokens.SingleDate.END_OF_CURRENT_YEAR
DateRange
dundas.embed.tokens.DateRange.CURRENT_DAY
dundas.embed.tokens.DateRange.CURRENT_MONTH
dundas.embed.tokens.DateRange.CURRENT_QUARTER
dundas.embed.tokens.DateRange.CURRENT_WEEK
dundas.embed.tokens.DateRange.CURRENT_YEAR
dundas.embed.tokens.DateRange.MONTH_TO_DATE
dundas.embed.tokens.DateRange.PREVIOUS_DAY
dundas.embed.tokens.DateRange.PREVIOUS_MONTH
dundas.embed.tokens.DateRange.PREVIOUS_QUARTER
dundas.embed.tokens.DateRange.PREVIOUS_WEEK
dundas.embed.tokens.DateRange.PREVIOUS_YEAR
dundas.embed.tokens.DateRange.QUARTER_TO_DATE
dundas.embed.tokens.DateRange.TODAY
dundas.embed.tokens.DateRange.YEAR_TO_DATE