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
299
Joined: Aug 25 2021 - 12:15am
Last seen: 7 months 1 week 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
7185
Joined: Aug 17 2018 - 3:48pm
Last seen: 3 months 2 weeks 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
299
Joined: Aug 25 2021 - 12:15am
Last seen: 7 months 1 week ago

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

 

yama818's picture
7185
Joined: Aug 17 2018 - 3:48pm
Last seen: 3 months 2 weeks 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
299
Joined: Aug 25 2021 - 12:15am
Last seen: 7 months 1 week 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
299
Joined: Aug 25 2021 - 12:15am
Last seen: 7 months 1 week ago
Feedback
randomness