Global Event: OnLoadReportParameters

The OnLoadReportParameters event passes a list of Parameter elements that can be reordered or modified before they are sent to the client for display. Called when report parameters are loaded, but before any processing has occurred. By default, parameters are sorted alphabetically by name.


For custom code the args array is structured as follows:

args[] is contains one object, a list of Parameter elements.

For .Net Assemblies the method signature is as follows:

void EventHandlerName(SessionInfo sessionInfo, List<Parameter> parameters)

Expected Return

The event has a void return value.


The following example sorts Parameters based on their dependencies on each other in custom SQL.

Namespaces: WebReports.Api.Common;

Custom Code:

System.Collections.Generic.List<Parameter> parameters = args[0]
as System.Collections.Generic.List<Parameter>; string paramPattern = @"@\w+@"; foreach(Parameter p in parameters)
{ int minPosition = 0; foreach (Match m in Regex.Matches(p.DropdownSqlStmt, paramPattern)) { string matchedParamName = m.Value.Replace("@",""); int matchIndex = sortedParameters.IndexOf(matchedParamName); Logger.Instance().Info("Found instance of " + matchedParamName
+ " (at index " + matchIndex
+ ") in parameter " + p.Id); if(matchIndex >= minPosition) minPosition = matchIndex+1; } sortedParameters.Insert(minPosition, p.Id); } parameters.Sort((a,b) => { int a_order = sortedParameters.IndexOf(a.Id); int b_order = sortedParameters.IndexOf(b.Id); if(a_order >= 0 && b_order >= 0) return (a_order - b_order); return 0; }); for(int i=1; i<parameters.Count; i++) { parameters[i].IsEnabled = false; } return null;

Hidden Article Information

Article Author
Exago Development
created 2017-02-21 16:09:21 UTC
updated 2019-06-20 15:18:29 UTC

Server Events, parameters, event handlers, list of server events, load, report, params, loadreportparameters, loadparameters, loadparams,
Have more questions? Submit a request