Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need to find the count of a field in iReport. For example i need to create a variable called "CallCount" which have count of "CallType" field. So i need to use "CallType" field in Category section of Piechart and "CallCount" variable as measure. So that pie chart will show the call types and its call counts. Please help me on this....

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
222 views
Welcome To Ask or Share your Answers For Others

1 Answer

If using the community charts (JFreeCharts), here is how you would do this.

You need to add a group to the report. Right click on the root object in the Report Inspector window. Click 'Add Report Group'. Then add a group with the field you're interested in. You don't have to add the header/footer bands.

This also creates the variable for you. It should be named something like 'GROUP_NAME_GROUP_COUNT'

Drag a new chart onto the summary band. (I believe it has to be in a summary band, although I could be wrong). Set the unique identifier (Key Expression) to '$F{CallType}' and the numeric value (Value Expression) to '$V{GROUP_NAME_GROUP_COUNT}')

If this doesn't work then try creating the variable manually. Add a variable, name it 'CallCount'. Set the class to 'java.lang.Integer', calculation to 'Count', and Reset Type to 'Group'. The reset group should match the group you created earlier. The Variable Expression should be the field you're interested in. In this case 'CallType'. Set the numeric value to 'CallType'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...