Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subreport error: Exception: Error fill report: Erro fill internal #165

Open
rizchen opened this issue Mar 20, 2024 · 3 comments
Open

Subreport error: Exception: Error fill report: Erro fill internal #165

rizchen opened this issue Mar 20, 2024 · 3 comments

Comments

@rizchen
Copy link

rizchen commented Mar 20, 2024

I have attempted several methods to generate the report, but the report with subreports has not been successfully produced. Below are two methods I have tried and the error messages. Please assist in providing a solution or an example.

Describe the bug
Jaspersoft Studio: Subreport OK!
Pyreportjasper: Subreport get some error

PyReportJasper setting:

  1. Method1
    pyreportjasper = PyReportJasper()
    pyreportjasper.config(
    input_file,
    output_file,
    db_connection=db_connection,
    output_formats=output_formats,
    parameters={
    "start_date": '2024-01-01',
    "end_date": '2024-01-31',
    },
    locale='en_US'
    )
    Error Message(Method1):
    Exception: Error fill report: Erro fill internal: net.sf.jasperreports.engine.JRException: Resource not found at:

  2. Method2: add resource
    pyreportjasper = PyReportJasper()
    pyreportjasper.config(
    input_file,
    output_file,
    db_connection=db_connection,
    output_formats=output_formats,
    parameters={
    "start_date": '2024-01-01',
    "end_date": '2024-01-31',
    },
    locale='en_US',
    resource=RESOURCES_DIR
    )

Error Message(Method2):
Exception: Error fill report: Erro fill internal: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error loading object from InputStream.

Jrxml (subreport part):

<reportElement x="0" y="10" width="555" height="160" uuid="f68d53f9-b8fb-44d8-a261-419ead1f551c">
	<property name="com.jaspersoft.studio.unit.width" value="px"/>
	<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<subreportParameter name="start_date">
	<subreportParameterExpression><![CDATA[$P{start_date}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="end_date">
	<subreportParameterExpression><![CDATA[$P{end_date}]]></subreportParameterExpression>
</subreportParameter>
<subreportExpression><![CDATA["TEST_sub1.jrxml"]]></subreportExpression>

Questions:

  1. about setting, where should I correct?
  2. is there any document for subreport for pyreportjasper 2.1.3v?

Desktop (please complete the following information):

  • OS: Linux
  • Python version: 3.8
  • Library version: 2.1.3
  • Java version: 11.0.19
  • JVM: OpenJDK 64-Bit Server VM

Jaspersoft Studio (please complete the following information):

  • Version: 6.19.1
@jadsonbr
Copy link
Collaborator

We have released version 2.1.4, which implements data typing for parameters sent to the reports. Please try using the new version and let us know about your experience.

Here's the link to the example: link

How to use:

import os
from pyreportjasper import PyReportJasper

def report_with_params():
    try:
        RESOURCES_DIR = os.path.abspath(os.path.dirname(__file__))
        REPORTS_DIR = os.path.abspath(os.path.dirname(__file__))
        input_file = os.path.join(REPORTS_DIR, "myteste2", "params.jrxml")
        output_file = os.path.join(REPORTS_DIR, "myteste2",  "output_file")

        pyreportjasper = PyReportJasper()
        pyreportjasper.config(
            input_file,
            output_file,
            output_formats=["pdf"],
            parameters={
                'myString': {
                    'value': 'TESTE STRING VALUE', 
                    'type': pyreportjasper.TypeJava.String
                },
                'myInt': {
                    'value': 1, 
                    'type': pyreportjasper.TypeJava.Integer
                },
                'myDate': {
                    'value': '11/04/1991', 
                    'type': pyreportjasper.TypeJava.Date, 
                    'format_input': 'dd/MM/yyyy'
                },
            }
        )
        pyreportjasper.process_report()
        print("Result is the file below.")
        print(output_file + ".pdf")
    except Exception as e:
        print(f"Error occurred: {e}")


report_with_params()

@jadsonbr
Copy link
Collaborator

We had an error processing subreports that was fixed in version 2.1.4.

@rizchen
Copy link
Author

rizchen commented Apr 22, 2024

Still have subreport issue. Not sure If I should set up config for subreport or not.
Please help to provide the jrxml example with subreport case. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants