Is there a way to sort within iReport by the results of a variable expression for a Domain based report? I have a problem similar to this link. http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=48308 However, I need to use Domains because we have security layer that filters out certain rows. The problem I have is that we need to perform aggregation and then sort by that results of that aggregation because we then want to feed the top 5 or 10 entries to a chart. We can’t do it in the query because the query happens before the security layer filters out certain rows.