cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set prameters on a report source

Former Member
0 Kudos

HI,

I'm writing a JSF application that uses Crystal Reports. I am able to show the report with this tag.

<bocrv:reportPageViewer viewerName="CrystalViewer" reportSource="#{crystalReportManager.getReportSource('CrystalReport1.rpt')}" allowParameterPrompting="on"/>

The code for the crystalReportManager.getReportSource looks like this

public Object getReportSource(String reportPath)
    {
        try
        {
            IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();

            Object rptSrc = rptSrcFactory.createReportSource(reportPath, Locale.instance());

            return rptSrc;
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return null;
    }

I would like to set the properties so they will promt but I can't find any documentation on how to add a ParameterFieldDiscreteValue on a ReportSource object.

Thank you.

Matthew

Accepted Solutions (1)

Accepted Solutions (1)

ted_ueda
Active Contributor
0 Kudos

You're using the JSF report viewer tag to display reports, and you're using the JRC to retrieve the report.

The JPEReportSourceFactory is a fairly old method, commonly used back in JRC 10 when there wasn't a ReportClientDocument.

If you're using a newer version, then you can access the report via the ReportClientDocument, then set the parameters before passing it to the viewer, via ReportClientDocument.getDataDefController().getParameterFieldController().setCurrentValues(...).

Sincerely,

Ted Ueda

Answers (1)

Answers (1)

Adam_Stone
Active Contributor
0 Kudos

You will want to set the parameters to the viewer object when using a reportsource, as shown here:

http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/Viewers_SDK/viewerssdk_java_dg_do...