Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Reset DateDiff / Next issue Post Reply Post New Topic
Author Message
adztravers
Newbie
Newbie


Joined: 27 Jul 2018
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote adztravers Replybullet Topic: Reset DateDiff / Next issue
    Posted: 26 Nov 2019 at 5:19am
Hi All,

I have a the following datediff formula to calculate the minutes between a date column within a table.
Datediff('n',{FUNDER_AUDIT.CREATEDATE},Next({FUNDER_AUDIT.CREATEDATE}))

This formula sits within the details section but I want it to reset to zero every time the grouped value changes as the formula is just continuing down through the report. I hope this makes sense. I have attached screenshots of my report to help show what is going wrong.

IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 26 Nov 2019 at 9:09am
I think you need an if statement.  Something like this.

if {Funder} <> next({Funder}) then 0 else
Datediff('n',{FUNDER_AUDIT.CREATEDATE},Next({FUNDER_AUDIT.CREATEDATE}))

I am assuming that you are grouping on the field {Funder}
IP IP Logged
adztravers
Newbie
Newbie


Joined: 27 Jul 2018
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote adztravers Replybullet Posted: 26 Nov 2019 at 9:45pm
Hi Kevlray,

You absolute LEGEND! Thank you so much for your help with this. I have spent days trying to figure this out as I dip in and out of Crystal so my knowledge is always rusty. With your guidance it is now working with the below.

If {FUNDER_AUDIT.OPPORTUNITYID} <> NEXT ({FUNDER_AUDIT.OPPORTUNITYID})
Then 0 else
Datediff('n',{FUNDER_AUDIT.CREATEDATE},Next({FUNDER_AUDIT.CREATEDATE}))

Thanks again!

Edited by adztravers - 26 Nov 2019 at 10:06pm
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 27 Nov 2019 at 4:07am
It helps when I have done something similar in the past. :-)
IP IP Logged
adztravers
Newbie
Newbie


Joined: 27 Jul 2018
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote adztravers Replybullet Posted: 27 Nov 2019 at 4:40am
Really appreciate you sharing though. Thanks again!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.027 seconds.