randomdude946 Posted October 23, 2015 Share Posted October 23, 2015 Hello. I'm pretty new to JasperReports and I'd be glad if someone could help me with my question.How is it possible to fill crosstabs' cells with precalculated values? I know that crosstabs support automatic calculations like "count", "average" et cetera - but my calculations depend on rather complex database queries so I cannot embed them directly into my JRXML file.As a more concrete example, I want to fill these cells:In this example, I would pass objects of the class Animal (containing only attributes and setters/getters for year and type) to the crosstab's dataset.I thought about passing one extra field HashMap<String, HashMap<String, Integer>> to the report, filled with e.g.:<"1999", HashMap<"Cows", calculateValue("1999", "Cow")>><"1999", HashMap<"Chickens", calculateValue("1999", "Chickens")>><"1999", HashMap<"Crabs", calculateValue("1999", "Crabs")><"2000", HashMap<"Cows", calculateValue("2000", "Cow")>><"2000", HashMap<"Chickens", calculateValue("2000", "Chickens")><"2000", HashMap<"Crabs", calculateValue("2000", "Crabs")>> Then I would give my crosstab a dataset with $F{year} and $F{type} and use the <measurement> tag to access the HashMap by using these fields. But it seems that in the <measurement> tag of a crosstab I cannot access all dataset fields.Is this possible in the first place?[/code] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now