Page 1 of 1
using Sum with a custom valuetype
Posted: Thu May 07, 2020 12:45 pm
by ivar
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
Re: using Sum with a custom valuetype
Posted: Mon May 11, 2020 8:28 am
by Lech Kulikowski
Hello,
It should work.
Please send us a sample report with test data that reproduces the issue for analysis.
Thank you.
Re: using Sum with a custom valuetype
Posted: Mon May 11, 2020 5:21 pm
by ivar
I'll have to put some things together to create a proper sample. I get back to you.
Re: using Sum with a custom valuetype
Posted: Tue May 12, 2020 7:07 am
by ivar
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!
Re: using Sum with a custom valuetype
Posted: Thu May 14, 2020 5:55 pm
by HighAley
Hello.
We have made an improvement.
Your code will work as expected with our next build.
Thank you.
Re: using Sum with a custom valuetype
Posted: Thu May 14, 2020 5:58 pm
by ivar
Thanks! Much appreciated.
A question: Will it use the operators or will it cast to decimal?
Re: using Sum with a custom valuetype
Posted: Tue May 19, 2020 9:48 am
by Lech Kulikowski
Hello,
Is used a cast to decimal.
Thank you.