Good afternoon,
I'm creating a report in Jasper that contains a subreport (with Jaspersoft Studio). In order for it to be loaded, I have to indicate the subreport directory, which is in the same folder as the parent report. I'm currently using the following method in the parent report:
<subreport>
<reportElement x="1" y="65" width="250" height="25" uuid="330b01bb-6d94-4644-b718-0fe59f69ce93"/>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["C:\Users\john\Desktop\reports\subreport_test.jasper"]]></subreportExpression>
</subreport>
In this way, it can load. It works! However, I wanted it to be dynamic: that is, the subreportExpression would detect directly where it is, and thus would not have to enter the 'hard-coded' location, as in the above code.
By searching the Internet, you can use $ P {SUBREPORT_DIR}, but in my case give me null. I also tried using the following expression:
<subreportExpression><![CDATA["subreport_test.jasper"]]></subreportExpression>
But to no avail. He can not sense where he is.
Does anyone have any suggestions? Thanks!