I am stuck. I am using Crystal Reports XI and retrieving data from a SQL database. The goal of the report is to return cases that can be destroyed each calendar year. To determine when a case can be destroyed, the youngest child dob + 27 years on the case is compared to the latest order event + 6 years (of which there are 6 order types), and the file destruction date is whichever is later.
File Destroy Date = DOB of the youngest child + 27 years OR 6 years from the date of the last order, whichever date is later. Display for previous calendar year.
Report Information:
1. All of the children plus their dob and all of the events plus event date on the case are returned.
2. The following fields are returned: case number, childname, dob, event, eventdate, eventid.
3. Formula Fields:
a. DOBPlus27Yrs: adds 27 years to each child’s dob on the case.
DateAdd('yyyy',27,{Command.DOB})
b. EventPlus6Hrs: adds 6 years to the eventdate for each event on the case.
DateAdd('yyyy',6,{Command.EVENT_DATE_TIME})
c. EventIDReq: indicates if eventid is one of 6 ids.
IF {Command.EVENT_TYPE_ID} in [1000111, 1000188, 385, 397, 412, 775, 781] then 1 else 0;
d. DOB27 vs Event6:
IF {@DOBPlus27Yrs} >= {@EventPlus6Yrs} then 1
else 0;
4. The report is grouping on case number and a group selection formula is being used to only return the youngest child on each case.
({Command.DOB}=minimum({Command.DOB},{Command.CASE_NUM})
I am having trouble pulling all of this together. I added to the group selection formula AND
sum({@EventIDReq}, {Command.CASE_NUM})>1 but then the cases that did not have an eventid for the EventIDReq formula, did not display which is not what I wanted. If an order does not exist, then the dob+27 years for the youngest child on the case should be the file destruction date.
Example of data:
CaseNum ChildName DOB DOB+27 Event EventDate EventDate+6 EventID
CS-00001 Doe, Jane 08/13/1998 08/13/2025 Ref Rec 12/28/2010 12/28/2016 1* 505 0**
CS-00001 Doe, Jane 08/13/1998 08/13/2025 Order Rec 12/05/2011 12/05/2017 1 385 1
CS-00003 Doe, John 07/19/2005 07/19/2032 Hrg - Rev 01/23/2012 01/23/2018 1 123 0
EX-00001 Doe, Jane 08/13/1998 08/13/2025 Order Rec 12/05/2011 12/05/2017 1 385 1
*Formula D
**Formula C
Expected Results:
CaseNum Child DOB DOB+27 Event EventDate EventDate+6 EventID FDD
CS-00001 Doe, Jane 08/13/1998 08/13/2025 Order Rec 12/05/2011 12/05/2017 1 385 1 08/13/2025
CS-00003 Doe, John 07/19/2005 07/19/2032 1 123 0 07/19/2032
EX-00001 Doe, Jane 08/13/1998 08/13/2025 Order Rec 12/05/2011 12/05/2017 1 385 1 08/13/2025
FDD = File Destruction Date
Thanks for your expertise and help!
File Destroy Date = DOB of the youngest child + 27 years OR 6 years from the date of the last order, whichever date is later. Display for previous calendar year.
Report Information:
1. All of the children plus their dob and all of the events plus event date on the case are returned.
2. The following fields are returned: case number, childname, dob, event, eventdate, eventid.
3. Formula Fields:
a. DOBPlus27Yrs: adds 27 years to each child’s dob on the case.
DateAdd('yyyy',27,{Command.DOB})
b. EventPlus6Hrs: adds 6 years to the eventdate for each event on the case.
DateAdd('yyyy',6,{Command.EVENT_DATE_TIME})
c. EventIDReq: indicates if eventid is one of 6 ids.
IF {Command.EVENT_TYPE_ID} in [1000111, 1000188, 385, 397, 412, 775, 781] then 1 else 0;
d. DOB27 vs Event6:
IF {@DOBPlus27Yrs} >= {@EventPlus6Yrs} then 1
else 0;
4. The report is grouping on case number and a group selection formula is being used to only return the youngest child on each case.
({Command.DOB}=minimum({Command.DOB},{Command.CASE_NUM})
I am having trouble pulling all of this together. I added to the group selection formula AND
sum({@EventIDReq}, {Command.CASE_NUM})>1 but then the cases that did not have an eventid for the EventIDReq formula, did not display which is not what I wanted. If an order does not exist, then the dob+27 years for the youngest child on the case should be the file destruction date.
Example of data:
CaseNum ChildName DOB DOB+27 Event EventDate EventDate+6 EventID
CS-00001 Doe, Jane 08/13/1998 08/13/2025 Ref Rec 12/28/2010 12/28/2016 1* 505 0**
CS-00001 Doe, Jane 08/13/1998 08/13/2025 Order Rec 12/05/2011 12/05/2017 1 385 1
CS-00003 Doe, John 07/19/2005 07/19/2032 Hrg - Rev 01/23/2012 01/23/2018 1 123 0
EX-00001 Doe, Jane 08/13/1998 08/13/2025 Order Rec 12/05/2011 12/05/2017 1 385 1
*Formula D
**Formula C
Expected Results:
CaseNum Child DOB DOB+27 Event EventDate EventDate+6 EventID FDD
CS-00001 Doe, Jane 08/13/1998 08/13/2025 Order Rec 12/05/2011 12/05/2017 1 385 1 08/13/2025
CS-00003 Doe, John 07/19/2005 07/19/2032 1 123 0 07/19/2032
EX-00001 Doe, Jane 08/13/1998 08/13/2025 Order Rec 12/05/2011 12/05/2017 1 385 1 08/13/2025
FDD = File Destruction Date
Thanks for your expertise and help!