DateDiff totals

Stimulsoft Reports.WEB discussion
Post Reply
User avatar
LPohlmeyer
Posts: 2
Joined: Tue Feb 07, 2017 4:30 pm
Location: Georgetiwn, TX

DateDiff totals

Post by LPohlmeyer »

I have correctly calculated the DateDiff for my DataBand, of which the result lists 109 work orders, using this formula:
{DateDiff(WorkOrders.EndDate,WorkOrders.BeginDate)}
The result is formatted as time and is returned in hours, which is correct. When I format it as a number, it returns blank.

I'd now like to add up all those totals in my header band and divide that total by 10 (which would equal our number of work days). I'm new to this, getting some help from our vendor, but we're stuck here. I've tried this, formatted as time:
{SumTime(DataBand,DateDiff(WorkOrders.EndDate,WorkOrders.BeginDate))}
but the value returned is 8:00 AM, which isn't right.
I'd prefer the total be formatted as a number (total # of hours / 10)

So, I tried this, also formatted as time, the result is 0
{Sum(DataBand,DateDiff(WorkOrders.EndDate,WorkOrders.BeginDate))}
When I format it as a number, the return is 0.00
Lisa Pohlmeyer
Williamson County Road & Bridge
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: DateDiff totals

Post by Alex K. »

Hello,

We couldn't reproduce this bug.
Please send us a simple report with test data which reproduces the issue for analysis.

Also, please clarify which product, component and version you are use.

Thank you.
User avatar
LPohlmeyer
Posts: 2
Joined: Tue Feb 07, 2017 4:30 pm
Location: Georgetiwn, TX

Re: DateDiff totals

Post by LPohlmeyer »

I'm using a version that has been embedded into my application for report generation. It's Reports.Web, version 2015.3
After much googling, I found another post that referenced using DateDiff with some additional formatting. So to get the total number of hours for our Work Orders I came up with this:
{Sum(WorkOrders.EndDate.Subtract(WorkOrders.BeginDate).Hours)}

And to get the total number of work days for us (10 hr days) I used this:
{Sum(WorkOrders.EndDate.Subtract(WorkOrders.BeginDate).Hours)/(10)}

There may be simpler ways by assigning variables, but I don't know how to do them. I'm trying desperately to learn the structure of our program so I can choose the correct fields and then to understand the syntax that Stimulsoft uses, yeah that's a tough one. To me, the user guide makes lots of assumptions. If anyone has a resource, I'd love to investigate that further. I realize that our Work Order system is going to rely heavily on these reports, I want to produce accurate data in a timely fashion. Willing to learn.
Lisa Pohlmeyer
Williamson County Road & Bridge
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: DateDiff totals

Post by HighAley »

Hello.

The DateDiff() function returns the TimeSpan value. So it you need to use Sum() function, you should convert the TimeSpan to other suitable type.

The reports are compiled to a class and is rendered by our engine.
So you could use any C# or VB.NET expression in your reports.

Thank you.
Post Reply