Jump to content
We've recently updated our Privacy Statement, available here ×

Print When expression remove column


arnyo911

Recommended Posts

Hello,

 

I have a report with a table into a subReport, I try to remove some columns if it's necessary, but the variable didn't find, 


                            <jr:column width="66" uuid="cdbf56d1-49b3-4bc7-9100-4147e1942eaa">
                                <property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne8"/>
                                <printWhenExpression><![CDATA[$F{myFieldMap}.containsKey( "x1" )]]></printWhenExpression>
                                <jr:columnHeader style="Table_TH" height="30" rowSpan="1">
                                    <staticText>
                                        <reportElement x="0" y="0" width="66" height="30" uuid="9f0a82df-9776-4f43-813f-07da5cc852f5"/>
                                        <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                        <text><![CDATA[X1]]></text>
                                    </staticText>
                                </jr:columnHeader>
                                <jr:columnFooter style="Table_CH" height="30" rowSpan="1">
                                    <textField>
                                        <reportElement x="0" y="0" width="66" height="30" uuid="3c953992-5d30-48fa-86cd-4e2850b34937"/>
                                        <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                        <textFieldExpression><![CDATA[$F{myFieldMap}.get("x1")]]></textFieldExpression>
                                    </textField>
                                </jr:columnFooter>
                                <jr:detailCell style="Table_TD" height="30">
                                    <textField>
                                        <reportElement x="0" y="0" width="66" height="30" uuid="adf5155c-305d-4f11-842c-a2f2912c114e"/>
                                        <textElement textAlignment="Center" verticalAlignment="Middle">
                                            <font size="8"/>
                                        </textElement>
                                        <textFieldExpression><![CDATA[$F{myFieldMap}.get("x1")]]></textFieldExpression>
                                    </textField>
                                </jr:detailCell>
                            </jr:column>

with "<textFieldExpression><![CDATA[$F{myFieldMap}.get("x1")]]></textFieldExpression> " : I have no problem but with the "<printWhenExpression><![CDATA[$F{myFieldMap}.containsKey( "x1" )]]></printWhenExpression>", I have the following error : 

net.sf.jasperreports.engine.design.JRValidationException: Report design not valid : 
     1. Field not found : myFieldMap
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:280)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:152)

 

Thanks And Regards ;)

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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...