2 Attachment(s)
Crystal Report problem in sum of data
Hey guys
Im having a problem in my crystal report where i want to see the sum of the quantity of items and their subtotal but my crystal report seems to sum the wrong data
here is the data when i run my program and preview the crystal report:
Attachment 104717
what i want to see is the sum of the quantity and the subtotal not the number of items listed in the report
but when i preview the crystal report using report preview the sum of data is working
here is the crystal report when i don't run my program:
Attachment 104719
here is my code when viewing crystal report in my program:
Code:
Public Sub ReportTotalSalesItems(ByVal LV As ListView)
Dim rReport As New ReportTotalSales
Dim row As DataRow = Nothing
Dim ds As New DataSet
ds.Tables.Add("SalesTransactionDetails")
With ds.Tables(0).Columns
.Add("InvoiceNo")
.Add("ProductCode")
.Add("ProductName")
.Add("QuantitySold")
.Add("SubTotal")
End With
For Each LVI As ListViewItem In LV.Items
row = ds.Tables(0).NewRow
row(0) = LVI.Text
row(1) = LVI.SubItems(1).Text
row(2) = LVI.SubItems(2).Text
row(3) = LVI.SubItems(3).Text
row(4) = LVI.SubItems(4).Text
ds.Tables(0).Rows.Add(row)
Next
rReport.SetDataSource(ds.Tables(0))
ReportViewer.CrystalReportViewer1.ReportSource = rReport
please help me guys :(
Re: Crystal Report problem in sum of data
I Solved it.. when i add the data in the crystal report it converts my data to string thats why the report uses COUNT instead of SUM. So I use the "ToNumber" formula in crystal report then inserted it as the substitute for quantity and subtotal.