Print Page | Close Window

Reset DateDiff / Next issue

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22841
Printed Date: 02 May 2024 at 11:32pm


Topic: Reset DateDiff / Next issue
Posted By: adztravers
Subject: Reset DateDiff / Next issue
Date 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.




Replies:
Posted By: kevlray
Date 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}


Posted By: adztravers
Date 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!


Posted By: kevlray
Date Posted: 27 Nov 2019 at 4:07am
It helps when I have done something similar in the past. :-)


Posted By: adztravers
Date Posted: 27 Nov 2019 at 4:40am
Really appreciate you sharing though. Thanks again!



Print Page | Close Window