Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to pass parameters in the URL to run an Ad Hoc Report


    vchiem
    • Features: Ad Hoc, Input Controls Version: v6.4 Product: JasperReports® Server

    Issue:

    We have an Ad Hoc View with filters that we saved as an Ad Hoc Report.

    How do we pass the filter parameters via the URL to run the report ?

     


    Solution:

    When an Ad Hoc view containing filters is saved as an Ad Hoc report, the name of the parameter/s is not displayed on the properties of the report. 

    But if you export the report to a zip file and extract the contents, then there will be a report xml file that you can open to find out. 

    For example, if the Ad Hoc Report is saved as "Ad Hoc View Customer Report" then in the zip file there is a file named "Ad_Hoc_View_Customer_Report.xml" under the report folder, resourcespublicReports.

    Within this xml file you can find the name of the parameter under the inputControl element :

     <inputControl>
            <localResource
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                exportedWithPermissions="false" xsi:type="inputControl">
                <folder>/public/Reports/Ad_Hoc_View_Customer_files</folder>
                <name>country_1</name>
    
    

    In this example, the filter was created as country and country_1 as the name of the parameter. 

    You can then pass this in the URL with the following format :

    http://<server>:<port>/jasperserver-pro/flow.html?_flowId=viewReportFlow&reportUnit=/public/Reports/Ad_Hoc_View_Customer_Report&standAlone=true &ParentFolderUri=/public/Reports&j_username=jasperadmin&j_password=jasperadmin&output=pdf&country_1=USA

     

    This will then output the Ad Hoc report to PDF format with the parameter in effect.

    Note 1: If you have multiple filters / parameters then you can pass them as well by appending them to the URL, such as ..&country_1=USA&city_1=Seattle

    Note 2: This is not the same as passing filters to open the Ad Hoc View which is covered in Enhancement Request incident JS-32359.

    Related Articles:

    JS-32359 Ad Hoc views doesn't accept input controls to be passed on URLs as reports do


    ref: 01612109 


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...