using variables with group as reset type

By: Jessica Daniel - jrdorbital
using variables with group as reset type
2003-01-28 06:28
Receiving an error when trying to use the system generated count variable for my group. The group the xml file is showing the group has been created, but the compiler is throwing an error. Below is the error, the xml code for the group, and the java code used to create the group. Any help appreciated.
Thanks

Jessica

//compiler error

Caused by: orbtrac.server.exception.OrbTracException: Error compiling report c:\tools\reports\1d8f230a-1c20-11d7-8ca8-db79afc
f3fe8.class: Report design not valid :
1. Variable not found : VehicleName_COUNT
at orbtrac.server.report.ReportGeneratorBean.buildReportDesign(ReportGeneratorBean.java:1964)
at orbtrac.server.report.ReportGeneratorBean.generateReport(ReportGeneratorBean.java:110)
at orbtrac.server.report.ReportGeneratorBean.fillReport(ReportGeneratorBean.java:2011)

//xml code

<group name="VehicleName" isStartNewColumn="false" isStartNewPage="false" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0">
<groupExpression>$F{VehicleName}</groupExpression>
- <groupHeader>
- <band height="23">
- <line direction="TopDown">
<reportElement positionType="Float" x="0" y="2" width="802" height="0" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
<graphicElement pen="2Point" stretchType="NoStretch" fill="Solid" />
</line>
- <textField isStretchWithOverflow="false" evaluationTime="Now" isBlankWhenNull="false" hyperlinkType="None">
<reportElement mode="Opaque" x="0" y="4" width="802" height="18" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
- <textElement textAlignment="Left" lineSpacing="Single">
<font reportFont="Group" />
</textElement>
- <textFieldExpression class="java.lang.String">
- <![CDATA[ "Vehicle Name : " + $F{VehicleName}
]]>
</textFieldExpression>
</textField>
</band>
</groupHeader>
- <groupFooter>
- <band height="65">
- <textField isStretchWithOverflow="false" evaluationTime="Now" isBlankWhenNull="false" hyperlinkType="None">
<reportElement mode="Opaque" x="0" y="50" width="842" height="13" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
- <textElement textAlignment="Center" lineSpacing="Single">
<font reportFont="Detail" />
</textElement>
- <textFieldExpression class="java.lang.String">
- <![CDATA[ $V{VehicleName_COUNT} + " Total Records in Group "
]]>
</textFieldExpression>
</textField>
</band>
</groupFooter>
</group>

//java code

JRDesignExpression expression = new JRDesignExpression();

group = new JRDesignGroup();
band = new JRDesignBand();

//set expression
expression.setText("$F{VehicleName}");
expression.setValueClass(java.lang.String.class);
expression.setName("VehicleName");

group.setExpression(expression);
group.setName("VehicleName");

//create header band
band.setHeight(23);

//get header band children
List groupHeaderChildren = band.getChildren();

//create Title Border
line = new JRDesignLine();

line.setWidth(sizeInfo.getWidth() - 40);
line.setHeight(0);
line.setX(0);
line.setY(2);
line.setForecolor(color.BLACK);
line.setMode(line.MODE_OPAQUE);
line.setPen(line.PEN_2_POINT);
groupHeaderChildren.add(line);

//create the text
textField = new JRDesignTextField();
font = new JRDesignFont();

textField.setWidth(sizeInfo.getWidth() - 40);
textField.setHeight(18);
textField.setX(0);
textField.setY(4);
font.setReportFont(fonts[3]);
textField.setFont(font);
textField.setForecolor(color.BLACK);
textField.setMode(textField.MODE_OPAQUE);
textField.setPositionType(textField.POSITION_TYPE_FIX_RELATIVE_TO_TOP);
textField.setTextAlignment(textField.TEXT_ALIGN_LEFT);

expression = new JRDesignExpression();
expression.setText(" \"Vehicle Name : \" + $F{VehicleName}");
expression.setName("VehicleName");
expression.setValueClass(java.lang.String.class);

textField.setExpression(expression);

groupHeaderChildren.add(textField);
group.setGroupHeader(band);

//create footer
band = new JRDesignBand();
band.setHeight(65);

group.setGroupFooter(band);

//create group
groups = design.getGroupsList();
groups.add(0, group);




By: Teodor Danciu - teodord
RE: using variables with group as reset type
2003-01-28 06:39

Hi,

This is where you got it wrong:

//create group
groups = design.getGroupsList();
groups.add(0, group);

You have to use the
JasperDesign.addGroup(JRDesignGroup)
method to add groups.
Adding them to a list that to previously get from
the report design object has no effect.

I hope this helps.
Teodor





By: Jessica Daniel - jrdorbital
RE: using variables with group as reset type
2003-01-28 06:54
Thanks, the suggestion worked.
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 16 years 9 months ago

0 Answers:

No answers yet
Feedback