Jump to content
JasperReports Library 7.0 is now available ×

Removing blank lines from report


wcound

Recommended Posts

I am using   Jaspersoft Studio    6.4.3.final to create a report.

In this report I have two string variables v_main at the report level and v_sub at the dataset level. 

   <variable name="v_main" class="java.lang.String" resetType="None">
        <initialValueExpression><![CDATA[null]]></initialValueExpression>
    </variable>

     <variable name="v_sub" class="java.lang.String" resetType="None">
            <variableExpression><![CDATA[$F{T_TEXT}]]></variableExpression>
            <initialValueExpression><![CDATA[null]]></initialValueExpression>
        </variable>

The string field T_TEXT from the dataset is used to set the v_sub value and is returned to v_main.

<returnValue fromVariable="v_sub" toVariable="v_main"/>

I then use the variable in a text field to display some text.

           <textField evaluationTime="Band" isBlankWhenNull="true">
                    <reportElement positionType="Float" mode="Opaque" x="0" y="0" width="320" height="10" isRemoveLineWhenBlank="true" backcolor="#B1FCFC" >
                        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    </reportElement>
                    <textElement>
                        <font fontName="Arial" size="8"/>
                    </textElement>
                    <textFieldExpression><![CDATA[LEN( $V{v_main})!=null?"Display This Text ":null]]></textFieldExpression>
                </textField>

The problem I am having is when the value in this field is null the field is still taking up space in the report.

I have added LEN( $V{v_main})!=null as a print when expression on this field to remove the blank line but have not been able to get it to work.

Any suggestions?

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

I can see that your field has positiontype="Float". Are all other fields that are below the Position type="Float" as well? If they are they should be moved upwards. If you have them set as Fix Relative to Top then they will be displayed where they are designed by your x&y position.

Link to comment
Share on other sites

This field is displayed in the page header band and in order to display the field I have to set the evaluation time to Band.

When I change the evaluation time to something else the field does move up when blank, however I no longer get any data displaying in the field.

I will test out moving the field from the  header band to the detail band to see if that makes any difference.

I have tested out moving the field to the detail band but that does not make any difference.

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