Dong Lam Trien

Dong Lam Trien

  • 833
  • 986
  • 145.7k

Can assign to XtraReport dynamic data calculate the total ?

Feb 6 2016 1:55 AM
Suppose I have the following code:
[CODE]
private void button1_Click(object sender, EventArgs e)
{
DataTable dt = CreateTableBill(10);
rptReport rpt = new rptReport();
rpt.DataSource = dt;
rpt.ShowPreview();
}
private static DataTable CreateTable(int RowCount)
{
DataTable tbl = new DataTable();
tbl.Columns.Add("ID", typeof(int));
tbl.Columns.Add("Product", typeof(string));
tbl.Columns.Add("Number", typeof(int));
tbl.Columns.Add("UnitPrice", typeof(int));
for (int i = 0; i < RowCount; i++)
tbl.Rows.Add(new object[] { i + 1, String.Format("Product {0}", i), 3 - i, 2.5 * 100 });
return tbl;
}
[/CODE]
to turn on their schools dt can be assigned to schools dt
XrTableCell1 = [Product];
XrTableCell2 = [Number];
XrTableCell3 = [UnitPrice];
XrTableCell4 = [Number] * [UnitPrice];
XrTableCell5 = Sum ([Number] * [UnitPrice]);
when you open the report in design mode, I want to calculate the sum of XrTableCell5, I have to XrTableCell5 under DataBindings-> Text: assignment: Sum ([Number] * [UnitPrice]), but the result None, why not calculate the total be ? you see attach file http://www.mediafire.com/view/s1fs5fhxnz4z1f2/Sumbill.jpg