Hi, I'm using Jaspersoft Studio 6.0.1 final and I would like to get return values from a sub-dataset used in a table element within the main report.
Looking at the settings there is clearly a feature that should allow this but it seems to be functiong in compeltely the wrong way, and the UI seesm to suggest it works the same way as parameters.
From my understanding the flow should be as follows:
Main dataset parameters -> (Paramters mapping) -> sub-dataset parameters
Sub dataset variables -> (Return Values mapping) -> main report variables
If you look at the settings for a Table Dataset definition you will see 'Return Values which are configured just the same as those of a Sub-Report, however they seem to be working the wrong way:
When you open up the 'Return Values' dialog and add new new value it seems ot be working the wrong way round, the 'From Variable' list is empty and expects you to type in a name - I think this should be a list of variables in the Sub-Dataset. The 'To Variable' lists the variables in the Sub-Dataset and not the variables in the Main Report, see what I mean about the wrong way round:
You may think I've got it wrong - Jaspersoft must know what they are doing, right? - but if you type the name of a variable in your main report into 'From Variable' it wont compile and fails with an error 'Return value destination value not found'. If you then create a variable in the Sub-Dataset to match the name of the 'From Variable' and a variable in the Main Report to match the 'To Variable' the report compiles.
You may think your now onto a winner - wrong! All you seem to get are null values at either end of the link, nothing seems to be propergating between the sub dataset and the main report in any direction.
Another problem seems to be with the Incrementer Factory Class, having saved your return value as above it creates an empty attribute in the JRXML which fails to compile:
<returnValue fromVariable="w_test" toVariable="amount_total" incrementerFactoryClass=""/>
If you remove the incrementerFactoryClass attribute your report will compile, you can also manually change the to and from variabke names here to work the way it should, this also solves the 'Return value destination value not found' error but still nothing is propergated between the dataset and main report.
I don't think I'm going mad, I may be though, but this seems like an unfinished, untested forgotten about feature that needs some work.
I'd really like to be able to use it to save writing bunches of sub queries in my main report to return values that I get in my sub-datasets.
I'd love to see this fixed please.