Reset DateDiff / Next issue
Printed From: Crystal Reports Book — Forum Name: Technical Questions
Posted By: adztravers — 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.
Posted By: kevlray — 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 — 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
Posted By: kevlray — 27 Nov 2019 at 4:07am
It helps when I have done something similar in the past. :-)
Posted By: adztravers — 27 Nov 2019 at 4:40am
Really appreciate you sharing though. Thanks again!
|