mfelipe.ayala Posted November 28, 2016 Share Posted November 28, 2016 Hi everyone,I would like to show a subreport using this detail.Prod1 Price1 Prod5 Price5Prod2 Price2 Prod6 Price6Prod3 Price3 Prod7 Price7Prod4 Price4 Prod7 Price8I hope that someone can help me.Thanks! Link to comment Share on other sites More sharing options...
reportdev Posted December 2, 2016 Share Posted December 2, 2016 use this code and replace your fields <?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-02T14:26:12 --><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="sss" columnCount="2" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="376" columnSpacing="50" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d636513c-6fad-4279-973d-754c6d542965"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="PRODSUP"/> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <style name="Crosstab_CH" 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="Crosstab_CG" 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="RowBanding"> <conditionalStyle> <conditionExpression><![CDATA[$V{REPORT_COUNT}%2==0]]></conditionExpression> <style mode="Opaque" backcolor="#F2F2F2"/> </conditionalStyle> </style> <queryString> <![CDATA[select (trunc(sysdate+1) + level -1) as business_date, extract(year from (trunc(sysdate+1) + level -1)) yearfrom dualconnect by sysdate + level -1 < sysdate + 5000]]> </queryString> <field name="BUSINESS_DATE" class="java.sql.Timestamp"/> <field name="YEAR" class="java.math.BigDecimal"/> <columnHeader> <band height="20"> <staticText> <reportElement mode="Opaque" x="180" y="0" width="200" height="20" forecolor="#FFFFFF" backcolor="#FF0400" uuid="dc1f8377-01ea-460d-975c-9a8cf7d3c401"/> <textElement textAlignment="Center"> <font isBold="true"/> </textElement> <text><![CDATA[Price]]></text> </staticText> <staticText> <reportElement mode="Opaque" x="0" y="0" width="180" height="20" forecolor="#FFFFFF" backcolor="#FF0400" uuid="eb0beb3c-cced-47bf-804e-8a7f768f1f0c"/> <textElement textAlignment="Center"> <font isBold="true"/> </textElement> <text><![CDATA[Product]]></text> </staticText> </band> </columnHeader> <detail> <band height="20"> <textField> <reportElement style="RowBanding" x="1" y="0" width="180" height="20" uuid="076918a4-6c44-440b-b20e-9cb79f67212f"/> <textElement textAlignment="Center"/> <textFieldExpression><![CDATA[$F{YEAR}]]></textFieldExpression> </textField> <textField> <reportElement style="RowBanding" x="180" y="0" width="201" height="20" uuid="049aea15-a587-4d2d-a222-ac399f6496d5"/> <textElement textAlignment="Center"/> <textFieldExpression><![CDATA[$F{BUSINESS_DATE}]]></textFieldExpression> </textField> </band> </detail></jasperReport> Link to comment Share on other sites More sharing options...
mfelipe.ayala Posted December 12, 2016 Author Share Posted December 12, 2016 Thanks reportdev,The solutions works fine. Thanks!However, it prints all the records vertically using all the high size. It means, we show all the records in one colum and then show the other column. For example:Prod1 Price1 Prod8 Price8Prod2 Price2 Prod3 Price3 Prod4 Price4 Prod5 Price5Prod6 Price6Prod7 Price7I would like to show them using the two columns like this.Prod1 Price1 Prod5 Price5Prod2 Price2 Prod6 Price6Prod3 Price3 Prod7 Price7Prod4 Price4 Prod7 Price8Thanks Link to comment Share on other sites More sharing options...
reportdev Posted December 12, 2016 Share Posted December 12, 2016 Hi,so do you have only 8 values that will be displayed all the time?if yes, then you can decrease the page height to 60-80 pixels and the report truncates it all the time.if no and you cannot guess the number of records, then i would suggest leave the report as is. 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