Reset DateDiff / Next issue

Printed From: Crystal Reports Book — Forum Name: Technical Questions

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.

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}
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
It helps when I have done something similar in the past. :-)
Really appreciate you sharing though. Thanks again!