# Jasper Subreport Null Values

**URL:** <https://forum.servoy.com/t/jasper-subreport-null-values/21240>\
**Category:** Questions\
**Created:** [May 29, 2024, 2:27pm UTC](https://forum.servoy.com/t/jasper-subreport-null-values/21240 "2024-05-29T14:27:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomasz.jarosz](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tomasz.jarosz](https://forum.servoy.com/u/tomasz.jarosz)\
**Post date:** [May 29, 2024, 2:27pm UTC](https://forum.servoy.com/t/jasper-subreport-null-values/21240/1 "2024-05-29T14:27:06Z")

</div>

I am creating a report in Jasper, simply passing the foundset for a datasource, where the main report has some basic information and my sub-report contains info from a relation. When I run the report through Servoy the main section is rendered normally and the sub-report static text is there but the sub-report has nulls for all of my fields. The relation does contain info so I don’t know why it’s not showing up.

This is how I am including my sub-report.

On the subreport I defined this simple field $F{myrelation.id}

Am I missing something? Any help would be appreciated, thanks.

---

<div class="post-metadata">

**Author:** ![robert.edelmann](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/robert.edelmann/32/4494_2.png) [@robert.edelmann](https://forum.servoy.com/u/robert.edelmann)\
**Post date:** [May 29, 2024, 3:39pm UTC](https://forum.servoy.com/t/jasper-subreport-null-values/21240/2 "2024-05-29T15:39:12Z")

</div>

you pass an empty datasource as the data fro the subreport, that will not work.

You have to pass the relation to the report and define the fields / relations from the relation-foundset in the subreport.

It looks like this in our reports:  
field

```auto
<field name="bautagebuch_wetter_to_bautagebuch_firmen" class="net.sf.jasperreports.engine.JRDataSource"/>

```

subreport:

```auto
<subreport>
[...]
	<dataSourceExpression><![CDATA[$F{bautagebuch_wetter_to_bautagebuch_firmen}]]></dataSourceExpression>
	<subreportExpression><![CDATA[com.servoy.plugins.jasperreports.JasperReportsResourceLoader.loadReport($P{SVY_SUBREPORT_DIR} + $P{SVY_REPORT_DIR} + "bautagebuch_vhb_komplett_anwesenheit.jrxml")]]></subreportExpression>
</subreport>

```

---

<div class="post-metadata">

**Author:** ![tomasz.jarosz](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tomasz.jarosz](https://forum.servoy.com/u/tomasz.jarosz)\
**Post date:** [May 29, 2024, 5:00pm UTC](https://forum.servoy.com/t/jasper-subreport-null-values/21240/3 "2024-05-29T17:00:53Z")

</div>

> tomasz.jarosz:  
> I am creating a report in Jasper, simply passing the foundset for a datasource, where the main report has some basic information and my sub-report contains info from a relation. When I run the report through Servoy the main section is rendered normally and the sub-report static text is there but the sub-report has nulls for all of my fields. The relation does contain info so I don’t know why it’s not showing up.
> 
> This is how I am including my sub-report.
> 
> On the subreport I defined this simple field $F{myrelation.id}
> 
> Am I missing something? Any help would be appreciated, thanks.

Thanks Robert, you the man!
