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

Examples of org.eclipse.birt.report.model.api.ScriptDataSetHandle


    return f;
  }

  public static TableHandle createTable(int rows) throws Exception {
    String dataSet = "Data Set";
    ScriptDataSetHandle dataSetHandle = elementFactory.newScriptDataSet(dataSet);
    dataSetHandle.setDataSource("scriptedDataSource");

    dataSetHandle.setOpen("i=0;");

    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);
View Full Code Here

TOP

Related Classes of org.eclipse.birt.report.model.api.ScriptDataSetHandle

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.