Totals for custom type properties

edited 10:35AM in FastReport .NET
Hi,

I'm using FastReport.NET 1.9.1 with a list of business objects as a data source.

Business object has several properties of different standard types (such as String, double, DateTime), as well as properties of custom ref and value classes.

Custom classes having overloaded arithmetical operators and overloaded ToString methods for formatting. Also implements IConvertable interface.

Everything works fine, I can use these properties in various expressions.

But when I use them in Totals I get:

System.InvalidOperationException: Cannot implicitly add value to unidentified type.
at FastReport.Variant.op_Addition(Variant subjectVariant, Object value)
at FastReport.Data.Total.AddValue(Object value)
at FastReport.Data.Total.AddValue()
at FastReport.Data.TotalCollection.ProcessBand(BandBase band)
at FastReport.Engine.ReportEngine.ProcessTotals(BandBase band)
at FastReport.Engine.ReportEngine.ShowBand(BandBase band, Boolean getData)
...

This only happens when list of business objects has more than one object.

Tried overloading different addition operators, such as

static MyClass^ operator + (FastReport::Variant v1, MyClass^ v2);
static FastReport::Variant v1 operator + (FastReport::Variant v1, MyClass^ v2);

Nothing helps.

Am I missing something, should I implement some interfaces for custom classes or inherit from some class, or register them somehow with FastReport as it's done for custom PictureObjects?

Thanks,
Alexander

Comments

  • the event handler prepares a list of summary values against which a Custom Total will be calculated. For this purpose, it creates a summary datasource and copies the summary values to an array. After that, the array is sorted and passed to an appropriate method that calculates a median or quartile value against the provided array

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.