Return Values from Sub Dataset to Main Dataset in Jasper Reports
Sometime it is required to return values from sub dataset to main report dataset but due to bug in the jasper studio we are unable to it. Please refer this bug link
Steps to return values from sub dataset to main report dataset
1) Create two variable one in subreport dataset (lets say SubDataset_Var) and one in main report dataset (lets say MainDataset_Var).
2) Suppose this sub dataset is used by table component. Click on table component and goto properties window (dataset tab) it will show you below screen
3) Click on return values button it will open one pop up window , see the below image
In above image, you can see instead of MainDataset_Var it is showing SubDataset_Var in “To Variable”. So now in “From Variable” just put the MainDataset_Var name. then click ok.
It will add follow line in JRXML file
<returnValue fromVariable="MainDataset_Var" toVariable="SubDataset_Var" incrementerFactoryClass=""/>
4) Open source of JRXML and replace the fromVariable value to toVariable value and vice versa and remove the incrementerFactoryClass=””.
<returnValue fromVariable="SubDataset_Var" toVariable="MainDataset_Var">
Now you can use MainDataset_Var in your main report.
Note : Change the Evoluation Time of component in which you are going to use main dataset variable.
Best Open Source Business Intelligence Software Helical Insight is Here