Jump to content
We've recently updated our Privacy Statement, available here ×

how to pass data from web2py controller and how can i access that datas to query in jasper report


nimaraheesh
Go to solution Solved by nimaraheesh,

Recommended Posts

def getreport():
    result = {}
    formdata = request.vars
    to_date = formdata['to_date']
    from_date = formdata['from_date']
    vehicle_no = formdata['veh_no']
    customer = formdata['customer']
    estimate = formdata['estimate']
    invoice= formdata['invoice']
    jobcard = formdata['jobcard']
    data = """
        <reportExecutionRequest>
            <reportUnitUri>/reports/samples/naokiDemo</reportUnitUri>
            <async>true</async>
            <freshData>false</freshData>
            <saveDataSnapshot>false</saveDataSnapshot>
            <outputFormat>pdf</outputFormat>  
            <interactive>false</interactive>
        </reportExecutionRequest>
    """
    jasper_view = JasperView("jasperadmin", "jasperadmin", data)
    report_pdf = jasper_view.post()  # Get the report in PDF format

    # Set the appropriate headers and return the PDF as the response
    response.headers['Content-Type'] = 'application/pdf'
    response.headers['Content-Disposition'] = 'inline; filename="report.pdf"'
    return report_pdf

its part of my web2py controller now i want to send some data to jasper report query to get some dynamic results

 

Link to comment
Share on other sites

  • 2 weeks later...

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.
 

Link to comment
Share on other sites

  • Solution

i got it
 data = {
            "reportUnitUri": "/reports/samples/naokiDemo",
            "async": "false",
            "freshData": "false",
            "saveDataSnapshot": "false",
            "outputFormat": "pdf",
            "interactive": "false",
            "parameters":{
             "reportParameter":[
                 {"name":"queryConditions","value":[QCondition]},
                {"name":"headPara","value":[repHead]}
              ]
             }
        }

  • Thanks 1
Link to comment
Share on other sites

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...