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);