how to add a row dynamically in .jrxml file

0

HI,

could any one give an advise of how to add a row dynamically , ie only add row if user selects Yes to a question .

at moment we are adding the rows as static text, below is the current code , so i should only add 'Question 1 user has to select Yes or no' only when user selects Yes.

thank you

<band height="19" splitType="Stretch">
            <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <staticText>
                <reportElement style="FieldText" x="5" y="2" width="208" height="15" uuid="623b92e4-17b8-40b5-bb80-f99bf3550c71">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <text><![CDATA[Question 1 user has to select Yes or no]]></text>
            </staticText>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement style="FieldText" x="224" y="2" width="137" height="15" isRemoveLineWhenBlank="true" uuid="272896e9-5708-401b-9f20-2b0a7dba63d9">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement textAlignment="Left"/>
                <textFieldExpression><![CDATA[$F{_THIS}.getLaaAcquisition()]]></textFieldExpression>
            </textField>
            <line>
                <reportElement style="Line_TableWeak" stretchType="RelativeToBandHeight" x="218" y="0" width="1" height="19" forecolor="#B8B8B8" uuid="e5fc2804-77fe-4587-b61e-db82d48c43b1">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
            </line>
        </band>

NP16's picture
2
Joined: Apr 28 2020 - 11:08pm
Last seen: 4 months 3 weeks ago

1 Answer:

0

Add new detail band and set Print when expression to print only when condition apply

Mariano

mlopez_1's picture
966
Joined: Oct 21 2013 - 8:08am
Last seen: 2 hours 38 min ago
Feedback
randomness