B4J Question [ABMaterial] How to Feed master-detail ABJasperReports report ?

amminf

Active Member
Licensed User
Longtime User
In ABJasperReports, in demo, i don't found how to feed a master-detail .jrxml report definition.

In demo sample, only is possible to do Params.Put("myId", 1), but how to feed "detail" ?

upload_2016-6-15_17-11-3.png


Sample (from inet) is. (jr.jrxml definition)
B4X:
<?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="invoicePdf" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="30" bottomMargin="50">
    <property name="ireport.zoom" value="1.5"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="140"/>
    <property name="ireport.callouts" value="##Fri Mar 30 16:17:30 NPT 2012"/>
    <style name="table">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <subDataset name="dataset1"/>
    <subDataset name="Table Dataset 1"/>
    <subDataset name="Table Dataset 2"/>
    <parameter name="customerName" class="java.lang.String" isForPrompting="false"/>
    <parameter name="customerEmail" class="java.lang.String" isForPrompting="false"/>
    <parameter name="invoiceNumber" class="java.lang.String" isForPrompting="false"/>
    <parameter name="invoiceAmount" class="java.lang.Double" isForPrompting="false"/>
    <parameter name="invoiceDate" class="java.util.Date" isForPrompting="false"/>
    <parameter name="poNumber" class="java.lang.String" isForPrompting="false"/>
    <parameter name="paymentType" class="java.lang.String" isForPrompting="false"/>
    <field name="itemNo" class="java.lang.String"/>
    <field name="productName" class="java.lang.String"/>
    <field name="price" class="java.lang.Double"/>
    <field name="qty" class="java.lang.Integer"/>
    <field name="lineTotal" class="java.lang.Double"/>
    <group name="Total">
        <groupExpression><![CDATA[]]></groupExpression>
        <groupHeader>
            <band height="4"/>
        </groupHeader>
        <groupFooter>
            <band height="44">
                <rectangle>
                    <reportElement mode="Opaque" x="310" y="14" width="223" height="25" backcolor="#C7D8ED"/>
                    <graphicElement>
                        <pen lineColor="#666666"/>
                    </graphicElement>
                </rectangle>
                <staticText>
                    <reportElement x="322" y="17" width="121" height="20"/>
                    <textElement textAlignment="Center">
                        <font size="12" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Balance Due $]]></text>
                </staticText>
                <textField>
                    <reportElement x="433" y="17" width="89" height="20"/>
                    <textElement textAlignment="Right"/>
                    <textFieldExpression class="java.lang.Double"><![CDATA[$P{invoiceAmount}]]></textFieldExpression>
                </textField>
                <line>
                    <reportElement x="2" y="6" width="531" height="1"/>
                </line>
            </band>
        </groupFooter>
    </group>
    <title>
        <band height="73" splitType="Stretch">
            <staticText>
                <reportElement x="2" y="10" width="553" height="29" forecolor="#B9B9B9"/>
                <textElement textAlignment="Center">
                    <font size="18" isBold="true"/>
                </textElement>
                <text><![CDATA[Invoice]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band height="113" splitType="Stretch">
            <rectangle>
                <reportElement mode="Opaque" x="315" y="1" width="218" height="96" forecolor="#000000" backcolor="#C7D8ED"/>
                <graphicElement>
                    <pen lineColor="#666666"/>
                </graphicElement>
            </rectangle>
            <staticText>
                <reportElement x="2" y="2" width="98" height="20"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Customer Name :]]></text>
            </staticText>
            <staticText>
                <reportElement x="325" y="3" width="93" height="20"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Invoice Number :]]></text>
            </staticText>
            <staticText>
                <reportElement x="325" y="28" width="93" height="20"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Invoice Date :]]></text>
            </staticText>
            <staticText>
                <reportElement x="325" y="52" width="93" height="20"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Payment Type :]]></text>
            </staticText>
            <staticText>
                <reportElement x="325" y="76" width="93" height="20"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[PO Number :]]></text>
            </staticText>
            <staticText>
                <reportElement x="2" y="27" width="98" height="20"/>
                <textElement>
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Customer Email :]]></text>
            </staticText>
            <textField>
                <reportElement x="434" y="52" width="88" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$P{paymentType}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="434" y="76" width="88" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$P{poNumber}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="114" y="27" width="167" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$P{customerEmail}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="114" y="2" width="167" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$P{customerName}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="434" y="3" width="88" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$P{invoiceNumber}]]></textFieldExpression>
            </textField>
            <textField pattern="MMMMM dd, yyyy">
                <reportElement x="434" y="28" width="88" height="20"/>
                <textElement/>
                <textFieldExpression class="java.util.Date"><![CDATA[$P{invoiceDate}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="27" splitType="Stretch">
            <rectangle>
                <reportElement mode="Opaque" x="2" y="2" width="531" height="20" backcolor="#C0D4EC"/>
                <graphicElement>
                    <pen lineColor="#666666"/>
                </graphicElement>
            </rectangle>
            <staticText>
                <reportElement x="2" y="4" width="50" height="20"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="false"/>
                </textElement>
                <text><![CDATA[Item]]></text>
            </staticText>
            <staticText>
                <reportElement x="66" y="4" width="179" height="20"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="false"/>
                </textElement>
                <text><![CDATA[Description]]></text>
            </staticText>
            <staticText>
                <reportElement x="265" y="4" width="80" height="20"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="false"/>
                </textElement>
                <text><![CDATA[Unit Cost $]]></text>
            </staticText>
            <staticText>
                <reportElement x="358" y="4" width="80" height="20"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="false"/>
                </textElement>
                <text><![CDATA[Quantity]]></text>
            </staticText>
            <staticText>
                <reportElement x="454" y="4" width="79" height="18"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="false"/>
                </textElement>
                <text><![CDATA[Price $]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="29" splitType="Stretch">
            <textField>
                <reportElement x="12" y="5" width="54" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{itemNo}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="78" y="5" width="167" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{productName}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="265" y="5" width="57" height="20"/>
                <textElement textAlignment="Right"/>
                <textFieldExpression class="java.lang.Double"><![CDATA[$F{price}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="358" y="5" width="75" height="20"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression class="java.lang.Integer"><![CDATA[$F{qty}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="454" y="5" width="64" height="20"/>
                <textElement textAlignment="Right"/>
                <textFieldExpression class="java.lang.Double"><![CDATA[$F{lineTotal}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>

Detail
 
Top