Parameter scripts comprise:
- Domain script
- Mask script
- Filter Summary script
Click the links for further details.
Domain Script
Editor : Report tree > A Parameter > Script > Domain | Main purpose: Load the domain for a parameter. |
Description: Script used to build up the domain for a parameter. Without scripting, the domains for parameters are loaded different ways depending on parameter type: Projects - Connect the parameter to a question in a survey containing the project IDs that you want to load. Double-click the parameter to open the page where you can connect the project to a question. Questionnaire Elements - Manually build a hierarchical structure of questionnaire elements from the parameter designer page (double-click parameter to get there). Segments - Do it the same way as for questionnaire element, except that you drag segments into the tree structure. String Response - Connect parameter to a question the same way as for the project parameters. This makes the domain implicitly load the answer list of that question. If you use a domain script for a parameter, you override the default way of loading the domain. You have to do this loading explicitly from within the script. The advantage is that you can then load the domain differently, for example depending who the user is and what other selections the user has made for other parameters. Typically, you can do this based on the user’s role or some other information from a database designer table relating user’s to elements in lists. | |
Projects Example: To tie one or more projects to a report, include a parameter to your report.
var p : Project = this.confirmit.GetProject('pxxxxxxx');
The Questionnaire Elements can be used to include questions from a project into a drop-down menu. If you have several projects in your report, you can script which questions to display depending on the project selected in the project parameter (p_project).
if(state.Parameters.IsNull("p_project"))var pid : String = state.Parameters.GetProjectId("p_project");var questions : Question[] = project.GetQuestions(); If you do not wish to include for(var i : int=0; i<questions.length;i++) This script will iterate through the questions, and check if they are QuestionType OpenText or MultiOpen. If not, they will be added to the questions parameter. | |
Mask Script
Editor : Report tree > A Parameter > Script > Mask | Main purpose: Mask the domain of a parameter. |
Description: For these types of parameters, you can add a mask script to mask the parameter domain for example based on other selections. This script is typically used when the original domain can be loaded the default way, but the list of values should be masked in some way. You can choose whether to use inclusive or exclusive masks, i.e. whether the keys you add to the mask are those that should be included in or excluded from the domain. Mask script only applies to project, segment questionnaire element and string response parameter types. | |
Example – Removing a question from domain : mask.Access = ParameterAccessType.Exclusive; | |
Filter Summary Script
Editor : Report tree > A > Script > Filter summary | Main purpose: Customize the filter summary label of a parameter. |
Description: For some parameters it will make sense not to have one line in filter summary for each parameter. For example, if you use one parameter to choose which question to filter by, and another to select the filter values. In these cases you can choose to hide one of the parameters from the filter summary and customize your own label for the other one to have the filter on one line. | |
Example – Customize filter summary for filter : if(state.Parameters.IsNull("p_filter_q") || state.Parameters.IsNull("p_filter")) | |