Stimulsoft Web Reports error in calculations

Stimulsoft Dashboards.WEB discussion
Post Reply
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Stimulsoft Web Reports error in calculations

Post by IskandarAir »

Hi,

I am using Stimulsoft for Web reports. One of my reports should display worktime of an employee both in hours and decimal numbers. The numbers come from SQL server, for example 83 mins => converted to hours in decimal 1.38. Thus, I should calculate total hours within a month. I have the logic for calculating hh:mm format of those decimal converted numbers => $"{{(Math.Truncate({expression}) + (({expression} - Math.Truncate({expression})) * 60 / 100))}}". However, when the sum of the mins equal to 420, it is displayed as 6:60 instead of 7:00. Double data type is used for calculations.
Image
When the project was developed with the version 2017.1.6.0, there were not any issues related to the calculations. After updating to 2019.3.4, the problem has come to the surface. Could you, please help with this situation?

Best regards.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Stimulsoft Web Reports error in calculations

Post by Lech Kulikowski »

Hello,

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

Thank you.
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Stimulsoft Web Reports error in calculations

Post by IskandarAir »

Hi,

Here is the sample data. There it shows the result as decimal, however it is converted to hh:mm format in a real project. The issue is 6.59999999.

Best regards.
Attachments
test-sample.mrt
(13.62 KiB) Downloaded 165 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Stimulsoft Web Reports error in calculations

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your problem. Could you explain your issue in more detail?

Thank you.
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Stimulsoft Web Reports error in calculations

Post by IskandarAir »

Hi,

I have provided daily data in minutes. The bottom cell must show sum of those minutes in hour and minutes, like hh:mm. When the sum of the minutes are calculated manually, it gives 420 and if we convert it to hh:mm format by dividing by 60, it equals to 7:00. For doing this dynamically, the expression is written for the cell in yellow. The problem is, it gives a wrong result of the calculation, which is 6.599999. This is not the expected result. I think, I could explain the issue.

Best regards.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Stimulsoft Web Reports error in calculations

Post by Lech Kulikowski »

Hello,

The type conversion issue. Please check the following expression:
{(Math.Truncate(SumDIf(double.Parse(Data.Code.ToString())/60, double.Parse(Data.Code.ToString()) != -9999999)) + ((SumDIf(double.Parse(Data.Code.ToString())/60, double.Parse(Data.Code.ToString()) != -9999999) - Math.Truncate(SumDIf(double.Parse(Data.Code.ToString())/60, double.Parse(Data.Code.ToString()) != -9999999))) * 60 / 100))}

Thank you.
Attachments
test-sample.mrt
(13.99 KiB) Downloaded 160 times
Post Reply