I need to pull id number, name etc for each donor that has given 20 consecutive years. That is, any 20 consecutive years not just the last 20. Data will be pulled from one table. I am using Crystal Report 11. Any help would be appreciated.
I do not have crystal in front of me, so apologize in advance for any errors.
group by doner ID.
sort within group by date.
use a formula to decide if the current record's date is 1 year more than the previous record's date and act accordingly.
//{@datecheck}
numbervar dc;
IF onfirstrecord=true then dc := 1 else
IF Previous ({table.DonerID}) <> ({table.DonerID}) THEN dc := 1 ELSE
IF Year({table.data}) = year(previous({table.date}))+1 then dc := dc+1 else dc := dc;
If it is possible that a doner may give more than once a year, the formula would need a little modification.
//{@datecheck}
numbervar dc;
IF onfirstrecord=true then dc := 1 else
IF Previous ({table.DonerID}) <> ({table.DonerID}) THEN dc := 1 ELSE
[highlight #CC0000]IF Year({table.data}) = Year(previous({table.data})) then dc := dc ELSE[/highlight]
IF Year({table.data}) = year(previous({table.date}))+1 then dc := dc+1 else dc := dc;
I think I got it but now am getting an error saying "This function cannot be used because it must be evaluated later" that is referring to onfirstrecord.
numbervar dc;
IF onfirstrecord then dc := 1;
IF not onfirstrecord and Previous ({table.DonerID}) <> ({table.DonerID}) THEN dc := 1;
//IF Year({table.data}) = Year(previous({table.data})) then dc := dc ELSE
// do not need this as dc will remain unchanged unless any conditions met
IF Year({table.data}) = year(previous({table.date}))+1 then dc := dc+1 else dc := dc;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.