Java Code Examples for org.pentaho.reporting.engine.classic.core.MasterReport#addExpression()

The following examples show how to use org.pentaho.reporting.engine.classic.core.MasterReport#addExpression() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Backlog6746Test.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testLoadSaveAsExpression() throws Exception {
  FormulaExpression fe = new FormulaExpression();
  fe.setFormula( "TRUE()" );

  DateExpression de = new DateExpression();
  de.setDay( 10 );
  de.setMonth( 5 );
  de.setYear( 2005 );

  Backlog6746Expression e = new Backlog6746Expression();
  e.setName( "test" );
  e.addExpression( "my-property" , fe);
  e.addExpression( "my-property-2" , de);

  MasterReport r = new MasterReport();
  r.addExpression( e );

  MasterReport r2 = saveAndLoad( r );
  final Expression test = r2.getExpressions().get( "test" );
  Backlog6746Expression testCast = (Backlog6746Expression) test;
  FormulaExpression fe1 = (FormulaExpression) testCast.getExpressionMap().get("my-property");
  FormulaExpression fe2 = (FormulaExpression) e.getExpressionMap().get("my-property");
  Assert.assertEquals( fe1.getFormulaExpression(), fe2.getFormulaExpression() );
}
 
Example 2
Source File: ItemMaxFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testReport() throws Exception {
  final TableModel tableModel = createTableModel();
  final MasterReport report = createReport( tableModel );

  report.addExpression( create( "cell-sum", VALUE, null, COLUMN_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#cell-sum", true, null ) );

  report.addExpression( create( "detail-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#detail-sum", true, COLUMN_DIMENSION_B ) );

  report.addExpression( create( "row-b-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-b-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "row-a-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-a-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "column-a-sum", VALUE, null, COLUMN_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-a-sum", true, null ) );

  report.addExpression( create( "column-b-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-b-sum", true, COLUMN_DIMENSION_B ) );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 3
Source File: ItemMinFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testReport() throws Exception {
  final TableModel tableModel = createTableModel();
  final MasterReport report = createReport( tableModel );

  report.addExpression( create( "cell-sum", VALUE, null, COLUMN_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#cell-sum", true, null ) );

  report.addExpression( create( "detail-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#detail-sum", true, COLUMN_DIMENSION_B ) );

  report.addExpression( create( "row-b-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-b-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "row-a-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-a-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "column-a-sum", VALUE, null, COLUMN_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-a-sum", true, null ) );

  report.addExpression( create( "column-b-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-b-sum", true, COLUMN_DIMENSION_B ) );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 4
Source File: ItemAverageFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testReport() throws Exception {
  final TableModel tableModel = createTableModel();
  final MasterReport report = createReport( tableModel );

  report.addExpression( create( "cell-sum", VALUE, null, COLUMN_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#cell-sum", true, null ) );

  report.addExpression( create( "detail-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#detail-sum", true, COLUMN_DIMENSION_B ) );

  report.addExpression( create( "row-b-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-b-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "row-a-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-a-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "column-a-sum", VALUE, null, COLUMN_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-a-sum", true, null ) );

  report.addExpression( create( "column-b-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-b-sum", true, COLUMN_DIMENSION_B ) );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 5
Source File: TotalItemCountFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testReport() throws Exception {
  final TableModel tableModel = createTableModel();
  final MasterReport report = createReport( tableModel );

  report.addExpression( create( "cell-sum", VALUE, null, COLUMN_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#cell-sum", true, null ) );

  report.addExpression( create( "detail-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#detail-sum", true, COLUMN_DIMENSION_B ) );

  report.addExpression( create( "row-b-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-b-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "column-a-sum", VALUE, null, COLUMN_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-a-sum", true, null ) );

  report.addExpression( create( "row-a-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-a-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "column-b-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-b-sum", true, COLUMN_DIMENSION_B ) );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 6
Source File: Pre497IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testBug() throws ReportProcessingException {
  synchronized ( Pre497IT.class ) {
    querytracker = new HashSet();

    final MasterReport report = new MasterReport();
    report.setDataFactory( new TrackingStaticDataFactory() );
    report.setQuery( "org.pentaho.reporting.engine.classic.core.bugs.Pre497IT#createMasterReport" );
    report.addExpression( new RandomValueExpression( "MR" ) );

    final SubReport sreport = new SubReport();
    sreport.setQuery( SUBREPORT_QUERY );
    sreport.addInputParameter( "A", "PA" );
    sreport.addExpression( new RandomValueExpression( "SR" ) );
    report.getItemBand().addSubReport( sreport );

    DebugReportRunner.createPDF( report );

    querytracker = null;
  }
}
 
Example 7
Source File: TotalItemMaxFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testReport() throws Exception {
  final TableModel tableModel = createTableModel();
  final MasterReport report = createReport( tableModel );

  report.addExpression( create( "cell-sum", VALUE, null, COLUMN_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#cell-sum", true, null ) );

  report.addExpression( create( "detail-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#detail-sum", true, COLUMN_DIMENSION_B ) );

  report.addExpression( create( "row-b-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-b-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "column-a-sum", VALUE, null, COLUMN_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-a-sum", true, null ) );

  report.addExpression( create( "row-a-sum", VALUE, COLUMN_DIMENSION_A, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-a-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "column-b-sum", VALUE, COLUMN_DIMENSION_B, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-b-sum", true, COLUMN_DIMENSION_B ) );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 8
Source File: Prd5169IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testSameParametersName() throws Exception {
  final TypedTableModel model = createTestData();

  final MasterReport report = new MasterReport();
  report.setQuery( "default" );
  report.setDataFactory( new TableDataFactory( "default", model ) );

  DefaultParameterDefinition mdef = new DefaultParameterDefinition();
  mdef.addParameterDefinition( new PlainParameter( "Rows", String.class ) );
  report.setParameterDefinition( mdef );
  report.getParameterValues().put( "Rows", "ALL" );

  final RelationalGroup group = new RelationalGroup();
  group.addField( "Rows" );
  report.setRootGroup( group );
  report.addExpression( new ValidateExpression() );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 9
Source File: ItemCountFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testReport() throws Exception {
  final TableModel tableModel = createTableModel();
  final MasterReport report = createReport( tableModel );

  report.addExpression( create( "cell-sum", null, COLUMN_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#cell-sum", true, null ) );

  report.addExpression( create( "detail-sum", COLUMN_DIMENSION_B, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#detail-sum", true, COLUMN_DIMENSION_B ) );

  report.addExpression( create( "row-b-sum", COLUMN_DIMENSION_A, ROW_DIMENSION_B ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-b-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "row-a-sum", COLUMN_DIMENSION_A, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#row-a-sum", true, COLUMN_DIMENSION_A ) );

  report.addExpression( create( "column-a-sum", null, COLUMN_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-a-sum", true, null ) );

  report.addExpression( create( "column-b-sum", COLUMN_DIMENSION_B, ROW_DIMENSION_A ) );
  report.addExpression( new ValidateFunctionResultExpression( "#column-b-sum", true, COLUMN_DIMENSION_B ) );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 10
Source File: OpenSourceAPIDemoHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Creates a report definition in code.
 * <p/>
 * It is more base to read the definition from an XML report template file, but sometimes you might need to create a
 * report dynamically.
 *
 * @return a report.
 */
public static MasterReport createStaticReport()
{

  final MasterReport result = new MasterReport();

  // set up the functions...
  final PageFunction f1 = new PageFunction("page_number");
  result.addExpression(f1);

  // set up the item band...
  final ItemBand itemBand = result.getItemBand();
  configureItemBand(itemBand);

  // set up the page footer...
  final PageFooter pageFooter = result.getPageFooter();
  configurePageFooter(pageFooter);

  return result;

}
 
Example 11
Source File: RowBandingFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testReport() throws Exception {
  final TableModel tableModel = createTableModel();
  final MasterReport report = createReport( tableModel );

  report.addExpression( create( "cell-sum", false ) );
  report.addExpression( new ValidateFunctionResultExpression( "#cell-sum", true, null ) );

  report.addExpression( create( "detail-sum", true ) );
  report.addExpression( new ValidateFunctionResultExpression( "#detail-sum", false, null ) );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 12
Source File: CrosstabMultiFactReverseDataIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testDiagonalReportProcessing() {
  final TypedTableModel model = createTestData();

  final MasterReport report = new MasterReport();
  report.setQuery( "default" );
  report.setDataFactory( new TableDataFactory( "default", model ) );
  report.setRootGroup( createCrosstab() );
  report.addExpression( new ValidateExpression() );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 13
Source File: Prd4922IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testEvaluationOrderTableBeforeExpression() {
  MasterReport report = new MasterReport();
  report.setDataFactory( create() );
  report.setQuery( "query" );
  report.addExpression( new SingleValueExpression( "expression" ) );
  report.addExpression( new ValidateValueExpression( "expression" ) );
  DebugReportRunner.execGraphics2D( report );
}
 
Example 14
Source File: CategorySetCollectorFunctionTest.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testDuplicateLabelsBug() {
  final DefaultTableModel model = new DefaultTableModel( new String[] { "Category", "Series", "Value" }, 4 );
  model.setValueAt( "A - 1", 0, 0 );
  model.setValueAt( "A", 0, 1 );
  model.setValueAt( new Double( 100 ), 0, 2 );
  model.setValueAt( "B - 1", 1, 0 );
  model.setValueAt( "B", 1, 1 );
  model.setValueAt( new Double( 200 ), 1, 2 );
  model.setValueAt( "C - 1", 2, 0 );
  model.setValueAt( "C", 2, 1 );
  model.setValueAt( new Double( 300 ), 2, 2 );
  model.setValueAt( "D - 1", 3, 0 );
  model.setValueAt( "D", 3, 1 );
  model.setValueAt( new Double( 400 ), 3, 2 );

  final CategorySetCollectorFunction fn = new CategorySetCollectorFunction();
  fn.setCategoryColumn( "Category" );
  fn.setSeriesName( 0, "Series" );
  fn.setValueColumn( 0, "Value" );
  fn.setSummaryOnly( false );
  fn.setGeneratedReport( false );
  fn.setSeriesColumn( false );
  fn.setName( "Collector" );

  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( report.getQuery(), model ) );
  report.addExpression( fn );
  report.addExpression( new ValidateFunction() );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 15
Source File: Prd5041IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testDependenciesTotalLevel() throws ReportProcessingException {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", new DefaultTableModel( 2, 2 ) ) );
  report.addExpression( new DependencyFunction( 2, "source" ) );
  report.addExpression( new ForwardExpression( 1, "forward", "source" ) );
  report.addExpression( new ValidateFunction( 0, "validate", "forward" ) );

  DebugReportRunner.createPDF( report );
}
 
Example 16
Source File: Prd3985IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testSyntaxErrorFormula() {
  final FormulaExpression function = new FormulaExpression();
  function.setName( "Test" );
  function.setFormula( "=IF(" ); // clearly an bogus formula
  function.setFailOnError( true );
  final MasterReport report = new MasterReport();
  report.addExpression( function );

  try {
    DebugReportRunner.createPDF( report );
    Assert.fail();
  } catch ( Exception e ) {
    // empty is ok here.
  }
}
 
Example 17
Source File: Prd5041IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testDependenciesMultiLevel2() throws ReportProcessingException {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", new DefaultTableModel( 2, 2 ) ) );
  report.addExpression( new DependencyFunction( 1, "source" ) );
  report.addExpression( new ForwardExpression( 0, "forward", "source" ) );
  report.addExpression( new ValidateFunction( 0, "validate", "forward" ) );

  DebugReportRunner.createPDF( report );
}
 
Example 18
Source File: SurveyScaleAPIDemoHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setupPageFooter(final MasterReport report)
{
  final Band pageFooter = report.getPageFooter();
  pageFooter.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(65));

  // add a horizontal line to set off the page footer
  pageFooter.addElement(HorizontalLineElementFactory.createHorizontalLine(0, Color.BLACK, null));

  final PageOfPagesFunction pageNofM = new PageOfPagesFunction();
  pageNofM.setName("PAGE_N_OF_M");
  pageNofM.setFormat("Page {0} of {1}");
  report.addExpression(pageNofM);

  final TextFieldElementFactory tff = new TextFieldElementFactory();
  tff.setName("PageIndicator");
  tff.setAbsolutePosition(new Point2D.Double(X4 + C4_WIDTH - 60.0, 50.0));
  tff.setMinimumSize(new FloatDimension(60.0f, 15.0f));
  tff.setFontName("Serif");
  tff.setItalic(Boolean.TRUE);
  tff.setFontSize(new Integer(8));
  tff.setHorizontalAlignment(ElementAlignment.RIGHT);
  tff.setFieldname("PAGE_N_OF_M");
  pageFooter.addElement(tff.createElement());

  final LabelElementFactory labelFactory = new LabelElementFactory();
  labelFactory.setText("Copyright \u00A9 2004 Object Refinery Limited. All Rights Reserved.");
  labelFactory.setFontName("Serif");
  labelFactory.setItalic(Boolean.TRUE);
  labelFactory.setFontSize(new Integer(8));
  labelFactory.setAbsolutePosition(new Point2D.Double(X1, 50.0));
  labelFactory.setMinimumSize(new FloatDimension(444.0f, 15.0f));
  labelFactory.setHorizontalAlignment(ElementAlignment.LEFT);
  pageFooter.addElement(labelFactory.createElement());
}
 
Example 19
Source File: BandInBandStackingDemoHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Create a report with a single report header band. This band contains several sub bands.
 *
 * @return the created report.
 */
public MasterReport createReport()
{
  final Band levelA1 = createBand("A1", Color.magenta, 0, 0, 100, 100);
  levelA1.addElement(createBand("A1-B1", Color.blue, 0, 50, 50, 50));
  levelA1.addElement(createBand("A1-B2", Color.yellow, 50, 0, 150, 50));
  // x=55%, y=5%, width=40%, height=100%
  final Band levelA2 = createBand("A2", Color.green, -50, 0, -50, -100);
  // x=5%, y=55%, width=40%, height=40%
  levelA2.addElement(createBand("A2-B1", Color.red, 0, -50, -50, -50));
  // x=55%, y=5%, width=40%, height=40%
  levelA2.addElement(createBand("A2-B2", Color.darkGray, -55, -5, -40, -40));

  final ReportHeader header = new ReportHeader();
  header.setName("Report-Header");
  header.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(-100));
  header.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(100));
  header.getStyle().setStyleProperty(ElementStyleKeys.MAX_WIDTH, new Float(Short.MAX_VALUE));
  header.getStyle().setStyleProperty(ElementStyleKeys.MAX_HEIGHT, new Float(100));

  header.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.ORANGE);

  header.addElement(levelA1);
  header.addElement(levelA2);

  final ContentFieldElementFactory cfef = new ContentFieldElementFactory();
  cfef.setFieldname("CreateComponent");
  cfef.setMinimumSize(new FloatDimension(400, 400));
  cfef.setAbsolutePosition(new Point2D.Float(0, 0));

  final ReportFooter footer = new ReportFooter();
  footer.addElement(cfef.createElement());

  final MasterReport report = new MasterReport();
  report.setReportHeader(header);
  report.setReportFooter(footer);
  report.setName("Band in Band stacking");

  report.addExpression(new ComplexComponentExpression("CreateComponent"));
  return report;
}
 
Example 20
Source File: SurveyScaleAPIDemoHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void setupItemBand(final MasterReport report)
{
  final Band band = report.getItemBand();
  band.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(20));

  final ItemCountFunction icf = new ItemCountFunction();
  icf.setName("ITEM_COUNT");

  report.addExpression(icf);

  final TextFieldElementFactory factory2 = new TextFieldElementFactory();
  factory2.setFontName("Serif");
  factory2.setFontSize(new Integer(11));
  factory2.setBold(Boolean.FALSE);

  final NumberFieldElementFactory nf = new NumberFieldElementFactory();
  nf.setName("ItemNumberTextField");
  nf.setAbsolutePosition(new Point2D.Double(X1, 7.0));
  nf.setMinimumSize(new FloatDimension(25.0f, 16.0f));
  nf.setVerticalAlignment(ElementAlignment.TOP);
  nf.setFieldname("ITEM_COUNT");
  nf.setFormatString("#0'.'");
  band.addElement(nf.createElement());

  factory2.setName("ItemField");
  factory2.setAbsolutePosition(new Point2D.Double(X1 + 25.0, 7.0));
  factory2.setMinimumSize(new FloatDimension(C1_WIDTH - 25.0f, 16.0f));
  factory2.setDynamicHeight(Boolean.TRUE);
  factory2.setTrimTextContent(Boolean.TRUE);
  factory2.setFieldname("Item");
  band.addElement(factory2.createElement());

  final SurveyScaleExpression iaf1 = new SurveyScaleExpression(1, 5);
  iaf1.setName("Survey Response");
  iaf1.setField(0, "Your Response");
  iaf1.setField(1, "Average Response");

  report.addExpression(iaf1);

  final ContentFieldElementFactory f = new ContentFieldElementFactory();
  f.setFieldname("Survey Response");
  f.setMinimumSize(new FloatDimension(C2_WIDTH, 15.0f));
  f.setAbsolutePosition(new Point2D.Double(X2, 6.0));
  band.addElement(f.createElement());

  final NumberFieldElementFactory nfef = new NumberFieldElementFactory();
  nfef.setFontName("Serif");
  nfef.setFontSize(new Integer(11));
  nfef.setName("F1");
  nfef.setAbsolutePosition(new Point2D.Double(X3, 7.0));
  nfef.setMinimumSize(new FloatDimension(C3_WIDTH, 16.0f));
  nfef.setFieldname("Your Response");
  nfef.setFormatString("0.00");
  nfef.setHorizontalAlignment(ElementAlignment.CENTER);
  band.addElement(nfef.createElement());

  nfef.setName("F2");
  nfef.setAbsolutePosition(new Point2D.Double(X4, 7.0));
  nfef.setFieldname("Average Response");
  band.addElement(nfef.createElement());
}