using Sum with a custom valuetype

Stimulsoft Reports.Net discussion
Post Reply
ivar
Posts: 17
Joined: Tue Aug 04, 2015 11:41 am

using Sum with a custom valuetype

Post by ivar » Thu May 07, 2020 12:45 pm

Hello,

I have a custom valuetype that is implicit castable to a decimal and a double.

When used in a report in interpretation mode it is not possible to do any calculations with it.
I like to be able to do simple math with it like {obj1 + obj2}

Is this possible?

Regards, Ivar
Lech Kulikowski
Posts: 2575
Joined: Tue Mar 20, 2018 5:34 am

Re: using Sum with a custom valuetype

Post by Lech Kulikowski » Mon May 11, 2020 8:28 am

Hello,

It should work.
Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
ivar
Posts: 17
Joined: Tue Aug 04, 2015 11:41 am

Re: using Sum with a custom valuetype

Post by ivar » Mon May 11, 2020 5:21 pm

I'll have to put some things together to create a proper sample. I get back to you.
ivar
Posts: 17
Joined: Tue Aug 04, 2015 11:41 am

Re: using Sum with a custom valuetype

Post by ivar » Tue May 12, 2020 7:07 am

I created a sample that shows the problem.
The operators.png shows that the type has operators available to do math.
The 'can be casted.png' shows that the type can be casted to a decimal/double.
The 'Errormessage.png' shows the error I get.

The preferred solution would be that Stimulsoft uses the operators and could sum Money with Money.
A less preferred solution would be that Stimulsoft casts the Money to a decimal and does the math with that.

Thanks!
Attachments
StimulsoftValueType.zip
(78.16 KiB) Downloaded 12 times
Operators.png
Operators.png (5.37 KiB) Viewed 392 times
ErrorMessage.png
ErrorMessage.png (59.26 KiB) Viewed 392 times
Can be casted.png
Can be casted.png (2.19 KiB) Viewed 392 times
HighAley
Posts: 8272
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: using Sum with a custom valuetype

Post by HighAley » Thu May 14, 2020 5:55 pm

Hello.

We have made an improvement.
Your code will work as expected with our next build.

Thank you.
ivar
Posts: 17
Joined: Tue Aug 04, 2015 11:41 am

Re: using Sum with a custom valuetype

Post by ivar » Thu May 14, 2020 5:58 pm

Thanks! Much appreciated.

A question: Will it use the operators or will it cast to decimal?
Lech Kulikowski
Posts: 2575
Joined: Tue Mar 20, 2018 5:34 am

Re: using Sum with a custom valuetype

Post by Lech Kulikowski » Tue May 19, 2020 9:48 am

Hello,

Is used a cast to decimal.

Thank you.
Post Reply