Package org.eclipse.birt.report.model.api.elements.structures

Examples of org.eclipse.birt.report.model.api.elements.structures.ComputedColumn


    dataSetHandle.setFetch("if ( i < " + rows + "){" + "row[\"Month\"] = (i + 1);" + "row[\"Product\"] = 'Product ' + i;" + "i++;"
        + "return true;" + "} else return false;");

    // Set computed columns
    ComputedColumn cs1 = StructureFactory.createComputedColumn();
    cs1.setName("Month");
    cs1.setExpression("row[\"Month\"]");
    cs1.setDataType("integer");

    ComputedColumn cs2 = StructureFactory.createComputedColumn();
    cs2.setName("Product");
    cs2.setExpression("row[\"Product\"]");
    cs2.setDataType("string");

    ComputedColumn cs3 = StructureFactory.createComputedColumn();
    cs3.setName("Amount");
    cs3.setExpression("row[\"Amount\"]");
    cs3.setDataType("integer");

    PropertyHandle computedSet = dataSetHandle.getPropertyHandle("computedColumns");
    computedSet.addItem(cs1);
    computedSet.addItem(cs2);
    computedSet.addItem(cs3);

    reportDesignHandle.getDataSets().add(dataSetHandle);

    TableHandle mytable = elementFactory.newTableItem(null, 3, 1, 1, 1);
    mytable.setWidth("100%");
    mytable.setProperty("dataSet", dataSet);

    computedSet = mytable.getColumnBindings();

    cs1.setExpression("dataSetRow[\"Month\"]");
    computedSet.addItem(cs1);

    cs2.setExpression("dataSetRow[\"Product\"]");
    computedSet.addItem(cs2);

    cs3.setExpression("dataSetRow[\"Amount\"]");
    computedSet.addItem(cs3);

    // Header
    RowHandle myheader = (RowHandle) mytable.getHeader().get(0);
View Full Code Here


        // otherwise data will not be populated into the report
        // Then add a new column to our row
        for (Iterator i = columnList.iterator(); i.hasNext();) {
          String columnName = (String) i.next();

          ComputedColumn computedColumn = StructureFactory
              .createComputedColumn();
          computedColumn.setName(columnName);
          computedColumn.setExpression("dataSetRow[\"" + columnName
              + "\"]");
          PropertyHandle computedSet = reportTable
              .getColumnBindings();
          reportTable.getColumnBindings().addItem(computedColumn);
View Full Code Here

      TableHandle table = designFactory.newTableItem("table", cols.size());
      table.setWidth("100%");
      table.setDataSet(designHandle.findDataSet("ds"));

      PropertyHandle computedSet = table.getColumnBindings();
      ComputedColumn cs1 = null;

      for( int i = 0 ; i < cols.size() ; i++ ) {
        cs1 = StructureFactory.createComputedColumn();
        cs1.setName((String) cols.get(i));
        cs1.setExpression("dataSetRow[\"" + (String) cols.get(i) + "\"]");
        computedSet.addItem(cs1);
      }

      // table header
      RowHandle tableheader = (RowHandle) table.getHeader().get(0);
View Full Code Here

TOP

Related Classes of org.eclipse.birt.report.model.api.elements.structures.ComputedColumn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.