Jump to content
Changes to the Jaspersoft community edition download ×

Number of rows per page


freshquiz

Recommended Posts

Hi guys,

 

I'm sorry because this is probably a really stupid question, but I have just started using iReport and Jasper Reports and I am stuck already.

 

The problem I have: The report that gets generated displays each records one per page, but I would like multiple records on each page.

 

Does anyone know how to achieve this?

Code:
<?xml version="1.0" encoding="UTF-8"?><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="report1" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">    <property name="ireport.zoom" value="1.0"/>    <property name="ireport.x" value="5"/>    <property name="ireport.y" value="0"/>    <style name="Crosstab Data Text" hAlign="Center"/>    <parameter name="RECORD_ID" class="java.lang.Integer" isForPrompting="false"/>    <queryString>        <![CDATA[sELECT ta.date_closed, a.micob_num, c.name "Client", e.equip_type, m.model_num, a.serial_no, a.asset_num, a.asset_state, te.name "Test Name", te.uom, te.lower_limit, te.upper_limit, r.result, r.pass, r.commentFROM adempiere.mi_task taJOIN adempiere.mi_asset aUSING (mi_asset_id)LEFT JOIN adempiere.mi_customer cUSING (mi_customer_id)JOIN adempiere.mi_device dUSING (mi_device_id)LEFT JOIN adempiere.mi_equip_type eUSING (mi_equip_type_id)LEFT JOIN adempiere.mi_model_num mUSING (mi_model_num_id)LEFT JOIN adempiere.mi_prev_maintenance pmUSING (mi_task_id)LEFT JOIN adempiere.mi_results rUSING (mi_prev_maintenance_id)LEFT JOIN adempiere.mi_test teUSING (mi_test_id)WHERE ta.mi_task_id = $P{RECORD_ID}order by mi_task_id;]]>    </queryString>    <field name="date_closed" class="java.sql.Date"/>    <field name="micob_num" class="java.lang.String"/>    <field name="Client" class="java.lang.String"/>    <field name="equip_type" class="java.lang.String"/>    <field name="model_num" class="java.lang.String"/>    <field name="serial_no" class="java.lang.String"/>    <field name="asset_num" class="java.lang.String"/>    <field name="asset_state" class="java.lang.String"/>    <field name="Test Name" class="java.lang.String"/>    <field name="uom" class="java.lang.String"/>    <field name="lower_limit" class="java.math.BigDecimal"/>    <field name="upper_limit" class="java.math.BigDecimal"/>    <field name="result" class="java.math.BigDecimal"/>    <field name="pass" class="java.lang.String"/>    <field name="comment" class="java.lang.String"/>    <detail>        <band height="317">            <textField>                <reportElement x="0" y="32" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{date_closed}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="100" y="32" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{micob_num}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="200" y="32" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{Client}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="300" y="32" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{equip_type}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="400" y="32" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{model_num}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="500" y="32" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{serial_no}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="600" y="32" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{asset_num}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="700" y="32" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{asset_state}]]></textFieldExpression>            </textField>            <staticText>                <reportElement x="44" y="226" width="100" height="20"/>                <textElement/>                <text><![CDATA[Test Name]]></text>            </staticText>            <textField>                <reportElement x="144" y="246" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{uom}]]></textFieldExpression>            </textField>            <staticText>                <reportElement x="144" y="226" width="100" height="20"/>                <textElement/>                <text><![CDATA[uom]]></text>            </staticText>            <textField>                <reportElement x="244" y="246" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{lower_limit}]]></textFieldExpression>            </textField>            <staticText>                <reportElement x="244" y="226" width="100" height="20"/>                <textElement/>                <text><![CDATA[lower_limit]]></text>            </staticText>            <textField>                <reportElement x="344" y="246" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{upper_limit}]]></textFieldExpression>            </textField>            <staticText>                <reportElement x="344" y="226" width="100" height="20"/>                <textElement/>                <text><![CDATA[upper_limit]]></text>            </staticText>            <textField>                <reportElement x="444" y="246" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{result}]]></textFieldExpression>            </textField>            <staticText>                <reportElement x="444" y="226" width="100" height="20"/>                <textElement/>                <text><![CDATA[result]]></text>            </staticText>            <textField>                <reportElement x="544" y="246" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{pass}]]></textFieldExpression>            </textField>            <staticText>                <reportElement x="544" y="226" width="100" height="20"/>                <textElement/>                <text><![CDATA[pass]]></text>            </staticText>            <textField>                <reportElement x="646" y="246" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{comment}]]></textFieldExpression>            </textField>            <staticText>                <reportElement x="644" y="226" width="100" height="20"/>                <textElement/>                <text><![CDATA[comment]]></text>            </staticText>            <staticText>                <reportElement x="0" y="0" width="100" height="20"/>                <textElement/>                <text><![CDATA[Date Closed]]></text>            </staticText>            <staticText>                <reportElement x="100" y="0" width="100" height="20"/>                <textElement/>                <text><![CDATA[MICOB Number]]></text>            </staticText>            <staticText>                <reportElement x="200" y="0" width="100" height="20"/>                <textElement/>                <text><![CDATA[Client]]></text>            </staticText>            <staticText>                <reportElement x="300" y="0" width="100" height="20"/>                <textElement/>                <text><![CDATA[Equipment Type]]></text>            </staticText>            <staticText>                <reportElement x="400" y="0" width="100" height="20"/>                <textElement/>                <text><![CDATA[Model Number]]></text>            </staticText>            <staticText>                <reportElement x="500" y="0" width="100" height="20"/>                <textElement/>                <text><![CDATA[serial Number]]></text>            </staticText>            <staticText>                <reportElement x="600" y="0" width="100" height="20"/>                <textElement/>                <text><![CDATA[Asset Number]]></text>            </staticText>            <staticText>                <reportElement x="700" y="0" width="100" height="20"/>                <textElement/>                <text><![CDATA[Asset State]]></text>            </staticText>            <textField pattern="">                <reportElement x="44" y="246" width="100" height="20"/>                <textElement/>                <textFieldExpression><![CDATA[$F{Test Name}]]></textFieldExpression>            </textField>        </band>    </detail></jasperReport>
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi, 

I'm not sure but could be because the height of your 'Detail' band is so large (317 pixels). The height of the page is 595 pixels with 20 pixel vertical margins. That means that 2 Detail bands don't fit in one page and this could be the reason of displaying each row in one page. Try setting a smaller height to the 'Detail' band. Do you really need the big blank space between both data? I attach your jrxml with a smaller height.

Hope this helps. 

Regards.

Link to comment
Share on other sites

Thank you so much augarte!

That was exactly it. Now it is obvious that it is such a rookie mistake, but at the time it was very frustrating not knowing the cause of it.

Now I have a better understanding of how these reports work, thank you augarte.

The issue was that I had too much vertical white space in between my fields and more than one row could not fit on one page because the vertical page size was smaller than two or more rows.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...