Setting parameter fields

After all the parameter fields have been initialized and added to the Fields object, the Fields object can be passed to the viewer.

To set parameter fields
  1. Create an instance of the viewer, passing it a reference to a report source object.

    CrystalReportViewer viewer = new CrystalReportViewer();

    viewer.setReportSource(reportSource);

  2. Set the parameter fields for the viewer by passing in the initialized Fields object.

    User prompting should be disabled to automatically use the set parameter field value.

    viewer.setParameterFields(fields);

    viewer.setEnableParameterPrompt(false);

  3. Call the viewer's refresh method to apply new parameters.

    viewer.refresh();

  4. Call the processHttpRequest method to launch the viewer in the current browser window.

    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);

  5. Call the dispose method to allow the viewer to perform the appropriate garbage collection and free system resources.

    viewer.dispose();



Crystal Decisions
http://www.crystaldecisions.com/
Support services
http://support.crystaldecisions.com/