patriciosard Posted January 17, 2017 Share Posted January 17, 2017 Is there an easy way to do this? I mean, I just dragged an element in the Detail 1 band named prices, which is a list of 5 numbers, is there a way in which these simple and ordinary 5 numbers appear sorted? Link to comment Share on other sites More sharing options...
reportdev Posted January 17, 2017 Share Posted January 17, 2017 If you are talking about values from a sql not getting sorted, then in the Outline, you can use Sort Fields and sort the fields as per you need.If you are talking about list element, I have tried the same use case and it is sorting the values by default. check this jrxml<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 --><!-- 2017-01-17T08:33:44 --><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="Blank_A4_2" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="7980397a-5175-4537-bd09-edc66d92a625"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="PRODSUP"/> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <subDataset name="list" uuid="3de8d4a4-f519-4692-a8f6-ab3e8654f217"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <queryString> <![CDATA[select 1 as ID from dualunionselect 4 as ID from dualunionselect 2 as ID from dualunionselect 3 as ID from dual]]> </queryString> <field name="ID" class="java.math.BigDecimal"/> <variable name="Count" class="java.lang.Integer" calculation="Count"> <variableExpression><![CDATA[$F{ID}]]></variableExpression> </variable> <variable name="max_count" class="java.lang.Integer" calculation="Highest"> <variableExpression><![CDATA[$V{Count}]]></variableExpression> </variable> </subDataset> <queryString> <![CDATA[select * from dual]]> </queryString> <field name="DUMMY" class="java.lang.String"/> <background> <band splitType="Stretch"/> </background> <detail> <band height="20" splitType="Stretch"> <componentElement> <reportElement x="0" y="0" width="200" height="20" uuid="9afe7f5a-eb09-48d0-b102-891ca089c427"> <property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/> </reportElement> <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical"> <datasetRun subDataset="list" uuid="00b13a3b-b8f1-4257-ba2e-3fb20996e0de"> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> </datasetRun> <jr:listContents height="20" width="200"> <textField> <reportElement x="0" y="0" width="100" height="20" uuid="1a0bbd56-549e-4ece-91e0-01e2c3bb4309"/> <textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression> </textField> </jr:listContents> </jr:list> </componentElement> </band> </detail></jasperReport>[/code] 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