Jump to content
Changes to the Jaspersoft community edition download ×

Placing lines with PrintWhenExpression


Recommended Posts

By: Carsten Jensen - ceejay24

Placing lines with PrintWhenExpression

2003-10-28 11:49

Hi!

 

Hope some one can help!!

 

I have this problem.

 

I have a line with 3 fields.

 

The first field "streches with overflow". It has a maximum length af 254 chars. The second and third fields are placed after the first one, when the first one has a max. length of 33 chars. When the first field s longer than that, the first field is printed in a textfield with a "PrintWhenExpression" (length() > 33. and on the "next line" the second and third fields are printed.

 

If the third field is not "covered" by the first field, (the first field is not extended to cover the third field), then the third field does not appear on the following line, but in the middle position of the first.

 

Example:

xxxxxx(first)xxxxxxxxxxxxx

xx(third)xxxxx

xx(second)xxxxx

 

I enclose the specs. of my report if it is of any help.

Concentrate on the fields (FLTEXT) PrintWhenExpresison(new Boolean($F{FLTEXT}.trim().length() > 33) and the field (FLMOMSBEL) (new Boolean(!$F{FLPRIS}.equalsIgnoreCase("0,00"))

 

The field FLMOMSBEL does not print on the line below FLTEXT when FLTEXT streches over several lines.

 

The xml in question:

<detail>

<band height="28">

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="0"

y="15"

width="78"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[new Boolean($F{FLTEXT}.trim().length() < 34)]]></printWhenExpression>

</reportElement>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLVARENR}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="77"

y="15"

width="154"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="true">

<printWhenExpression><![CDATA[new Boolean($F{FLTEXT}.trim().length() < 34)]]></printWhenExpression>

</reportElement>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLTEXT}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="456"

y="15"

width="77"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[new Boolean(!$F{FLPRIS}.equalsIgnoreCase("0,00"))]]></printWhenExpression>

</reportElement>

<textElement textAlignment="Right" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLPRIS}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="387"

y="15"

width="69"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[new Boolean(!$F{FLPRIS}.equalsIgnoreCase("0,00"))]]></printWhenExpression>

</reportElement>

<textElement textAlignment="Right" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLMOMSBEL}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="233"

y="15"

width="25"

height="12"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLKTOKODE}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="261"

y="15"

width="65"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLDECKTONR}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="325"

y="15"

width="60"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLKTONR}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="0"

y="1"

width="78"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[new Boolean($F{FLTEXT}.trim().length() > 33)]]></printWhenExpression>

</reportElement>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLVARENR}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="77"

y="1"

width="305"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="true">

<printWhenExpression><![CDATA[new Boolean($F{FLTEXT}.trim().length() > 33)]]></printWhenExpression>

</reportElement>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{FLTEXT}</textFieldExpression>

</textField>

<staticText>

<reportElement

mode="Transparent"

x="390"

y="1"

width="134"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="true">

<printWhenExpression><![CDATA[new Boolean($F{FLTEXT}.trim().length() > 33)]]></printWhenExpression>

</reportElement>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />

</textElement>

<text> </text>

</staticText>

</band>

</detail>

 

 

 

 

 

By: Carsten Jensen - ceejay24

RE: Placing lines with PrintWhenExpression

2003-10-30 05:00

Hi.

 

I've solved my problem.

 

I have placed a rectangle on line with the "stretchable" field on top of the fields with I want to "press down". The rectangle is specified to to stretch "RelativeToTallestObject".

 

I appreciate you guys that have tried to read my posting, and have given up, as I myself find it hard to understand.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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