#12 Bootstrap assigning report parameters

closed-out-of-date
nobody
None
5
2006-12-05
2005-04-05
Jasper Rosenberg
No

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

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

Discussion

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

     
    Attachments
  • Logged In: YES
    user_id=693586

    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.

     
  • Logged In: YES
    user_id=693586

    If you want to support query reports, you need this
    additional code at the front of
    ReportProviderImpl.getReportParameters():

    List reportParameters = new ArrayList();

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

    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() ==
    JRQueryChunk.TYPE_PARAMETER_CLAUSE) ||
    (chunk.getType() ==
    JRQueryChunk.TYPE_PARAMETER))
    {
    String parameterName = chunk.getText();

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

    reportParameter.setName(parameterName);
    reportParameter.setRequired(true);

    reportParameters.add(reportParameter);
    }
    }
    }
    }

    return reportParameters;
    }

     
  • Erik Swenson
    Erik Swenson
    2006-12-05

    Logged In: YES
    user_id=477376
    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