Totals - SUM problem
danni
Denmark
Hi
the expression for a total I convert a String to a Decimal.
When the databand I SUM over is empty, I get a conversion exception.
Note: I print the first row if the databand is empty.
the expression for a total I convert a String to a Decimal.
When the databand I SUM over is empty, I get a conversion exception.
Note: I print the first row if the databand is empty.
Comments
FastReport cannot handle this. It's up to you to convert a string to decimal correctly. You may create own function in the report code that performs the conversion and checks for empty values.
The ToDecimal(object obj) function should and do convert object values to a decimal, BUT it shouldnt be called if the datasource is empty. I have no way to correct this when using the Totals-SUM function as I see it.
Could you make a simple demo for me and send it to tz@fast-report.com? Maybe I misunderstood something...
I have to take it back - I think.
My colleague made a copy of a report that has a Total(sum).
On the copy, the reportobject [Total] was reomved without removing it from the list in the Data window.
This means that the expression in the list of Totals is validated no matter if it is draged on to the report?
We fixed it by deleting the Total.
in my sum function I try to convert a string to a decimal.
Somehow I need to check if the databand is empty within my expression?
I would think your standard functions had a default return value and used a try/catch?