title: Jasper Report (iReport) Pie Dataset from main dataset
body: <p>I want to use a pie chart per group in Jasper iReport, but I don't know how to create a dataset per group.</p>
  
  <p>Assume I have a table as follows:</p>
  
  <pre><code>Table users
  ---------
  category - user - status
  </code></pre>
  
  <p>Then I have a the following SQL</p>
  
  <pre><code>select * from users order by category
  </code></pre>
  
  <p>My display has a simple group band of category with detail showing each user and their status.  Ideally I would have each category group header show a pie chart with all the distinct statuses and their counts within that group.  I'm at a loss as how to do this in iReport.</p>
  
  <p>If I knew all the categories ahead of time I could just create a dataset for each one using the following:</p>
  
  <pre><code>select status, count(user) from user where category = &lt;current category&gt; group by status
  </code></pre>
  
  <p>I'm attempting to do this using a <code>JRMapCollectionDataSource</code> that resets each group and pulls the data from the rows in the group using a variable, but I'm not very familiar with the whole reset group and increment paradigm.</p>
  
  <p>Any help?</p>