Jane.Yu Posted December 12, 2016 Share Posted December 12, 2016 I use Jaspersoft Studio 6.3.0 professional. Is there any way to sort within a group? Seems the only way to do the sorting is in the Dataset and query editor. Thank you. Link to comment Share on other sites More sharing options...
Solution reportdev Posted December 12, 2016 Solution Share Posted December 12, 2016 it allows layered sorting. in the dataset itself,sort your group first,then add number of levels - sorting with the details<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 --><!-- 2016-12-12T11:19:04 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="two" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="794a4213-f2f1-4f2c-9086-ce9ee7c3cd23"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="PRODSUP"/> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="one" uuid="fd948d57-9430-44be-b22e-1ec391fbeb2e"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="PRODSUP"/> <queryString> <![CDATA[select 1 as id from dualunionselect 2 as id from dualunionselect 3 as id from dual]]> </queryString> <field name="ID" class="java.math.BigDecimal"/> </subDataset> <subDataset name="second" uuid="89e3be26-95a8-4fc6-8382-695a5f32733a"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="PRODSUP"/> <queryString> <![CDATA[select 4 as id from dualunionselect 5 as id from dualunionselect 6 as id from dual]]> </queryString> <field name="ID" class="java.math.BigDecimal"/> </subDataset> <queryString> <![CDATA[select main.*,case when 1=1 then 'Yes' end as hidingfrom (select 1 as value, 'first_dataset' as ID from dualunionselect 2 as value, 'second_dataset1' as ID from dualunionselect 2 as value, 'second_dataset4' as ID from dualunionselect 2 as value, 'second_dataset2' as ID from dual)main where 1 = 1]]> </queryString> <field name="VALUE" class="java.math.BigDecimal"/> <field name="ID" class="java.lang.String"/> <field name="HIDING" class="java.lang.String"/> <sortField name="VALUE"/> <sortField name="ID"/> <group name="VALUE"> <groupExpression><![CDATA[$F{VALUE}]]></groupExpression> <groupHeader> <band height="30"> <textField> <reportElement mode="Opaque" x="0" y="0" width="555" height="30" backcolor="#FF0000" uuid="6a83cb9e-70a7-4cca-a390-7d0cd67e8d47"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{VALUE}]]></textFieldExpression> </textField> </band> </groupHeader> </group> <background> <band splitType="Stretch"/> </background> <detail> <band height="30"> <textField> <reportElement x="80" y="0" width="475" height="30" uuid="de66aff2-b376-4b88-828c-2321a675581f"/> <textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression> </textField> </band> </detail></jasperReport> 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