How to get a count of records returned in an adhoc crosstab?

I am fairly new to JasperReports Server, but I'm getting the hang of it overall.  However, one thing is confounding me.  I cannot figure out how to get a count of records in a cross tab.

For example, my Incident domain contains fields for Region and Type, and a measure for Size (amongst other things).

I can create a crosstab that gives me the total (or average) size for incidents per Type across the top and Region down the left... but I cannot figure out how to get it to give me the total number of incidents in each.  Size is an optional field, so when I try putting it with Count All, I only get the number of non-null records, but I need the full total.

I figured out what feels like a hack - I put a calculated measure with a formala of "1" and then used Sum on that field, but that seems like the wrong thing to do.

Any help appreciated.  We're on version 7.0 right now but are about to update to 7.2.

beverleym's picture
Joined: Jul 24 2007 - 3:40am
Last seen: 2 months 3 hours ago

Re: answer from swood_1
I considered using Count All, but the problem with that is, unless I'm missing a different thing, it comes in REALLY ugly.  So in my results instead of saying something like "Number of Incidents" I get "Incident Primary Identifier (Count All)"

Is there a way in an ad-hoc view to rename a field?  Without creating calculated field of a different name that points to the original field and is just as much work as my original hack?

beverleym - 3 years 8 months ago

@swood_1 see above

beverleym - 3 years 8 months ago

1 Answer:

Count All on any field in the result that always has a value - like an id - would do it.

 

swood_1's picture
9280
Joined: Nov 15 2012 - 10:47am
Last seen: 3 years 3 weeks ago
Feedback
randomness