#12 Bootstrap assigning report parameters


When adding parameters to a report, we actually can ask
the jasper report for the names and types of its

This patch takes advantage of this to modify the
EditReportParameterMap.vm so that instead of providing
a dropdown of parameters to add, it is a list of
missing parameters.

If a missing parameter has the same name as an existing
parameter, then there is a button to add it directly.
If a missing parameter has no matching existing
parameter, then there is a button to create the
parameter (prepopulating the form with the known data
about the parameter).

OpenReports and JasperReports provided parameters are
excluded from the missing parameters list.

There are two things I don't like about this patch:
1. I wasn't sure where the best place was to put the
method to get the list of parameters from the actual
jasper report. For now, it is in ReportProvider.
2. When you create a parameter via the
EditReportParameterMap.vm, once you are done creating
the parameter, it should really take you back to the
editReportParameterMap.action for the original report
you were setting up.

This also, of course, precludes adding parameters to
the report that the report does not explicitly
reference. If this is overly restrictive, the original
add dropdown can be reintroduced as well.

Despite these weaknesses, I think it is still a big
help for the users not to have to look up the parameter
names/types outside of OpenReports.

Hope you find this useful.



  • Jasper Rosenberg

    Patch to use the jasper report object to help figure out report parameters

  • Jasper Rosenberg

    Logged In: YES

    QA just noticed that this patch breaks assigning parameters
    to query reports. If you decide to still use it, I
    recommend just adding back the Available Parameters section
    of the EditReportParameterMap.vm template.

  • Jasper Rosenberg

    Logged In: YES

    If you want to support query reports, you need this
    additional code at the front of

    List reportParameters = new ArrayList();

    if ((report.getQuery() != null) &&
    (report.getQuery().length() > 0))
    JRDesignQuery query = new JRDesignQuery();

    JRQueryChunk[] chunks = query.getChunks();
    if (chunks != null && chunks.length > 0)
    for (int i = 0; i < chunks.length; i++)
    JRQueryChunk chunk = chunks[i];
    if ((chunk.getType() ==
    (chunk.getType() ==
    String parameterName = chunk.getText();

    (ORStatics.BUILT_IN_PARAMETER_SET.contains(parameterName) ==
    ReportParameter reportParameter
    = new ReportParameter();



    return reportParameters;

  • Erik Swenson

    Erik Swenson - 2006-12-05

    Logged In: YES
    Originator: NO

    This patch is out of date, but similar functionality has been added to OpenReports Professional in the 2.1 release.

  • Erik Swenson

    Erik Swenson - 2006-12-05
    • status: open --> closed-out-of-date

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks