Jump to content
Changes to the Jaspersoft community edition download ×

Use Field from sub-dataset in chart subtitle


andrew.kerr

Recommended Posts

I have a report that contains 3 HTML5 charts. The data from each chart is driven by a sub-dataset. The sub-dataset query returns a field called 'order', that I want to include in the subtitle of the chart.

Currently, this is showing as 'null'

When I copy the query from one of the sub-datasets into the main report dataset, the Field value gets populated in the subtitle.

It appears as though the subtitle of the chart does not have access to the $F{} fields returned by the sub-dataset. The plot area of the chart is behaving properly.

Is there a way to get Field values from a sub-dataset into the chart subtitle?

Thanks

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

What exact record from the SubQuery should be used for rendering the SubTitle... Imagine you have Top10 Orders by customers in a PieChart... what exact customer name should appear in the SubTitle? The first, the second... all of them concatenated?!??! 

I guess therefore the SubTitle isn't made and so it uses just the fields by the MAIN Query and not by the SubDataSet-Query. So if you need some of the Results you could perhaps create a ChartCustomizerClass and use the API for manipulating the SubTitle.

hth + regards

C-Box

Link to comment
Share on other sites

Thanks for the answer C-Box. I know that my query only returns one value for that field (the same value in every record), so that isn't an issue for my use case.

I understand how that could be an issue if multiple records are returned, but why then is the SubTitle allowed to use the Fields from the main query? The main query could also return multiple records - yet the value is displayed in the SubTitle in that case. Which record does it choose? Why not disallow all use of Fields in the SubTitle if that is the problem?

Andrew

Link to comment
Share on other sites

Well imagine you have a main query that iterates through your customer table and collects all customers for the last sales in a year.

Now you group the main query by customer name and place a tiny pie chart into the group footer band to display the top10 sold items with an subquery. Then you could do something like this as SubTitle-Expression:

"Top10 items for " + $F{customerName}[/code]

and then you have an usecase where it makes sense to use the (parent) main-query fields within SubTitleExpression. But you can't use any of the SubDataSet fields from the SubItemsQuery per each customers... as this are probably 10 different ones.

So not sure ... but perhaps it's easier just to create an subSelect for your "OneAndOnlyResult" ?

hth + regards

C-Box

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...