The retrievePromptValues function

The retrievePromptValues function should be called when using parameters with custom controls, and supports both cascading and non-cascading prompts.

Call this function in the body onLoad handler to load the initial values of the prompt (or the parent prompt in the case of a cascading prompt). Call this function in the onChange handler of the control used to define the cascading parameter. The function will make calls to the server and get the prompt values to fill the parameter controls with updated values depending on the parent parameter value selected.

The retrievePromptValues function accepts the following arguments:

  • A string denoting the name of the report containing the definitions of the cascading parameters. The name must have been defined as the name attribute of a repositoryItem tag.
  • A string corresponding to the name of the parameter in the report. For cascading parameters, this string is the name of the cascading parameter group. The cascading group must be present in the report.
  • A user-defined function that accepts an array of value and display text for the new options. The array can be null, in which case the function should clear the control. This function will be called by retrieveCascadingPromptValues to populate the parameter controls with new values.
         function callback(options) {
            // logic to clear the control
            // logic to add value and display text to control
            for(var i = 0; i <options.length; i++) {
               control.value = options[i].value;
               Display Text for control = options[i].displayText;
            }
         }
  • An array of the selected preceding values present in the cascading group. This array is only needed for cascading parameters and should be omitted for a non-cascading parameter. The parameters must be in sequential order. To get the list of the parent cascading parameter, specify preceding values:
     var precedingvals= new Array();

The preceding values array has the following structure. For example, to get the list of cities in MN:

     precedingvals= new Array();
     precedingvals[0]= "USA";
     precedingVals[1]="MN";