do caculation on every row in databand
hi
this my code in fastreport.net to do some calculation for every row in databand on each page
of PreparedPages but it only works for the first row.
it would be a great help and very kind of you to rewrite my code.
public void CalculateSaalScore2()
{
double calc = 0;
FastReport.Preview.PreparedPages pages = Report.PreparedPages;
ReportPage P = pages.GetPage(Report.Preview.PageNo - 1);
var dataBand = Report.FindObject("Data3") as DataBand;
var dataSource = dataBand.DataSource;
for (int i = 0; i < dataSource.RowCount; i++)
{
TableCell objM1=(TableCell)dataSource.FindObject("CellM1");
TableCell objP1=(TableCell)P.FindObject("CellP1");
TableCell objM2=(TableCell)P.FindObject("CellM2");
TableCell objP2=(TableCell)P.FindObject("CellP2");
TableCell objSaalScore=(TableCell)P.FindObject("CellSaalScore");
calc= (Convert.ToDouble(objM1.Text)+Convert.ToDouble(objM2.Text)+ (Convert.ToDouble(objP1.Text)*2)+ (Convert.ToDouble(objP2.Text)*4) )/8 ;
objSaalScore.Text=calc.ToString();
if(Report.Preview != null)
{
Report.PreparedPages.ModifyPage(Report.Preview.PageNo - 1, objM1.Page as ReportPage);
//Refresh preview
Report.Preview.Refresh();
}
}