[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.birt] pagination with huge data

Jason,
i am working on reports to load data from xmlstream datsource. Things looks
good so far. But i havent found any solution for pagination for dynamice tables... and the other thing is sometimes we get huge data (100,000) . i dont how to control this pagination for this kind of data.
Do you have any suggestions regarding this?
Here is my code does dynamic creation table data with xmlstream as datasource
in on prepare...



-------------------------------------------------

<method name="onPrepare"><![CDATA[importPackage (Packages.org.eclipse.birt.report.model.api.simpleapi);
importPackage (Packages.java.util);
importPackage (Packages.org.eclipse.birt.report.model.api);
importPackage (Packages.org.eclipse.birt.report.model.api.elements);
importPackage (Packages.org.eclipse.birt.report.model.api.elements.structures);
map = reportContext.getAppContext().get("reportDisplayMap");
columnList = reportContext.getAppContext().get("selectedValues");


//get a reference to the ElementFactory
elementFactory = reportContext.getReportRunnable().designHandle.getElementFactory();
table = elementFactory.newTableItem("myNewTable", columnList.size());
table.setWidth( "100%" );
handle = reportContext.getReportRunnable().designHandle.findDataSet("Data Set");
table.setDataSet( handle );


// table header
header = table.getHeader().get(0);
// get the computed column set computedSet = table.getColumnBindings( );


// creating the columnbinding for( i=0; i < columnList.size(); i++){
cs1 = StructureFactory.createComputedColumn();
columnName = ""+columnList.get(i);
cs1.setName( columnName );
cs1.setProperty(ColumnHandle.WIDTH_PROP,(100 / columnList.size()) + "%");
switch ( columnName )
{
case "cost" :
case "cpc" :
case "averageMaxPrice" :
cs1.setExpression("headerctr = \"$\"+dataSetRow[\"" + columnName + "\"];headerctr;");
break;
case "ctr" :
cs1.setExpression("headerctr = dataSetRow[\"ctr\"]+\"%\";headerctr;");
break;
default :
cs1.setExpression("dataSetRow[\"" + columnName + "\"]");
break
}
computedSet.addItem(cs1);
}
// creating the header row
cellCounter = 0;
width = "0%";
if (columnList.size()>0){
width = (100/columnList.size())+"%";
}
for( i=0; i < columnList.size(); i++){
tcell = header.getCells().get(cellCounter);
mapValue = map.get(columnList.get(i));
label = elementFactory.newLabel(mapValue);
label.setText(mapValue+"*");
tcell.getContent().add(label);
tcell.setProperty(ColumnHandle.WIDTH_PROP,(100 / columnList.size()) + "%");
// tcell.setWidth(width);
tcell.setProperty( StyleHandle.FONT_WEIGHT_PROP,
DesignChoiceConstants.FONT_WEIGHT_BOLD );
cellCounter++;
}

// creating the table detail
detail = table.getDetail().get(0);
hr = StructureFactory.createHighlightRule();


			  hr.setOperator(DesignChoiceConstants.FILTER_OPERATOR_NE);
			  hr.setTestExpression("row.__rownum % 2");
			  hr.setValue1("0");
			  hr.setProperty(HighlightRule.STYLE_MEMBER, "highlightrow");
			  ph = detail.getPropertyHandle(StyleHandle.HIGHLIGHT_RULES_PROP);
             ph.addItem( hr );

value = "";
cellCounter = 0;
for( i=0; i < columnList.size(); i++){
tcell = null;
tcell = detail.getCells().get(cellCounter);
tcell.setProperty( StyleHandle.TEXT_ALIGN_PROP,
DesignChoiceConstants.TEXT_ALIGN_CENTER );
tcell.setProperty(ColumnHandle.WIDTH_PROP,(100 / columnList.size()) + "%");
value = columnList.get(i);
data = elementFactory.newDataItem(value);
data.setResultSetColumn(value); // Sets column value
tcell.getContent().add(data);
cellCounter++;
}


if ( params["rptprmSortOrder"].value != null )
{
var columnsort = params["rptprmSortOrder"].value;
sortCondition = StructureFactory.createSortKey( );
sortCondition.setKey("dataSetRow[\"" + columnsort + "\"]");
sortCondition.setDirection("asc");
sort = table.getPropertyHandle( TableHandle.SORT_PROP );
sort.addItem( sortCondition );
}
// table.setPageBreakInterval(2);
reportContext.getReportRunnable().designHandle.getBody().add( table );


]]></method>