Return variable from subdataset in main dataset

Hi Community,

hope someone can help me.

I am trying to return a value from a subdataset into the main dataset as mentioned at jaspersoft studio - How to add variable from subdataset to report? [Jasper] - Stack Overflow

I have created a variable (SUB_Varaible) in the subdataset and set the Expression to the relevant Databasefield:

 

Ein Bild, das Text enthält.

Automatisch generierte Beschreibung

I have then created another variable in the main dataset (Main_Variable):

Ein Bild, das Text enthält.

Automatisch generierte Beschreibung

In a list (or table) I created the return value mapping:

Ein Bild, das Text enthält.

Automatisch generierte Beschreibung

I then drag and drop the Main_Variable onto the report but it is still evaluated as “null”.

How can I fix this?

Thank you!

 

julian111's picture
101
Joined: Aug 25 2021 - 12:15am
Last seen: 1 month 3 days ago

5 Answers:

Perhaps the last step seems to be missing.

>I then drag and drop the Main_Variable onto the report but it is still evaluated as “null”.

After this, try setting 'EvaluationTime' to 'Report'.


yama818's picture
2802
Joined: Aug 17 2018 - 3:48pm
Last seen: 2 days 23 hours ago

Thanks! I already set it to "Report":

 

 

Do you have a change to upload a sample .jrxml where it works, please? 

julian111's picture
101
Joined: Aug 25 2021 - 12:15am
Last seen: 1 month 3 days ago

Unfortunately I have no other notices.
If you could attach the *.jrxml file, I might have some additional insights.

 

yama818's picture
2802
Joined: Aug 17 2018 - 3:48pm
Last seen: 2 days 23 hours ago

Attached the .jrxml. I have just used the sample DB for testing with the following SQL statement to have only one value:

 

select * from Address where Firstname = 'Laura' and Lastname = 'Miller'

Attachments: 
AttachmentSize
Binary Data test_return_values.jrxml5.64 KB
julian111's picture
101
Joined: Aug 25 2021 - 12:15am
Last seen: 1 month 3 days ago

just found the issue:

 

The calculation in the subvariable must not be set to "system" but to what is needed based on the data.

 

All the other settings above were fine.

 

Thanks anyway!

julian111's picture
101
Joined: Aug 25 2021 - 12:15am
Last seen: 1 month 3 days ago
Feedback