wcound Posted November 16, 2017 Share Posted November 16, 2017 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 More sharing options...
dinu5 Posted November 16, 2017 Share Posted November 16, 2017 I am not sure if this works. ($F{FieldName}==null)?" ":$F{FieldName} or Tick mark "Blank when NULL"' Link to comment Share on other sites More sharing options...
JTU Posted November 17, 2017 Share Posted November 17, 2017 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 More sharing options...
wcound Posted November 21, 2017 Author Share Posted November 21, 2017 All of the fields below are set to Float.This field that uses the expression is the only field in the report that does not move upwards. Link to comment Share on other sites More sharing options...
wcound Posted November 22, 2017 Author Share Posted November 22, 2017 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now