I have a situation in my db where I get multiple datetime stamps for parameters that I have identified as the start and stop times. The frontend tool permits the users to mark activities 'done' then reopen and mark 'done' again...and again....and again.
Anywho...I need to get the minimum of the start date and the maximum of the end date.
Here's the formula that I'm using to calcualate turnaround time:
//Formula to calculate TAT excluding holidays and weekend goes in the details section for each record
WhileReadingRecords;
Local DateVar Start := Date({V_BAR_SR_ACTIVITY.ACTIVITY_CREATED_DATE});
Local DateVar End := Date({V_BAR_ACTIVITY_AUDIT_TRAIL.DATE});
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
Local NumberVar i;
For i := 1 to Count (Holidays)
do (if Holidays in start to end then Hol:=Hol+1 );
If (Weeks + Days - Hol) > 1 then
Weeks + Days - Hol - 1
else if (Weeks + Days - Hol) = 1 then
Weeks + Days - Hol
else if (Weeks + Days - Hol) = 0 then
Weeks + Days - Hol + 1
What I really need is for {V_BAR_SR_ACTIVITY.ACTIVITY_CREATED_DATE} to be the minimum value from the db and for {V_BAR_ACTIVITY_AUDIT_TRAIL.DATE} to be the maximum value from the db.
It may help to know that this is my record selection formula:
not ({V_BAR_SR.CLASSIFICATION} in ["Clinical Programs", "SpecialtyRx"]) and
{V_BAR_SR.BUSINESS_UNIT} = "RxC-X-INS" and
{V_BAR_ACTIVITY_AUDIT_TRAIL.NEW_VALUE} = "Done" and
{V_BAR_ACTIVITY_AUDIT_TRAIL.FIELD} = "Status" and
{V_BAR_ACTIVITY_AUDIT_TRAIL.ACTIVITY_TYPE} = "Benefits QA Review" and
{V_BAR_ACTIVITY_AUDIT_TRAIL.DATE}={?Date} and
{V_BAR_SR.PG_CLIENT} = "Y" and
{V_BAR_SR.RELATED_TO_PROJECT} <> "Y" and
{V_BAR_SR_ACTIVITY.ACTIVITY_TYPE_CD} = "Benefits Coding"
The output that I'm getting on the report is every permutation of the TAT from the combinations of the start dates and end dates when the users marked the activities more than once. Yuck-o.
When I try using the Minimum or Maximum function in the TAT calculation, I get an error message.
I'm using CR 11.0.0.895.
How do I go about fixing this?
Thanks!!!
Anywho...I need to get the minimum of the start date and the maximum of the end date.
Here's the formula that I'm using to calcualate turnaround time:
//Formula to calculate TAT excluding holidays and weekend goes in the details section for each record
WhileReadingRecords;
Local DateVar Start := Date({V_BAR_SR_ACTIVITY.ACTIVITY_CREATED_DATE});
Local DateVar End := Date({V_BAR_ACTIVITY_AUDIT_TRAIL.DATE});
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
Local NumberVar i;
For i := 1 to Count (Holidays)
do (if Holidays in start to end then Hol:=Hol+1 );
If (Weeks + Days - Hol) > 1 then
Weeks + Days - Hol - 1
else if (Weeks + Days - Hol) = 1 then
Weeks + Days - Hol
else if (Weeks + Days - Hol) = 0 then
Weeks + Days - Hol + 1
What I really need is for {V_BAR_SR_ACTIVITY.ACTIVITY_CREATED_DATE} to be the minimum value from the db and for {V_BAR_ACTIVITY_AUDIT_TRAIL.DATE} to be the maximum value from the db.
It may help to know that this is my record selection formula:
not ({V_BAR_SR.CLASSIFICATION} in ["Clinical Programs", "SpecialtyRx"]) and
{V_BAR_SR.BUSINESS_UNIT} = "RxC-X-INS" and
{V_BAR_ACTIVITY_AUDIT_TRAIL.NEW_VALUE} = "Done" and
{V_BAR_ACTIVITY_AUDIT_TRAIL.FIELD} = "Status" and
{V_BAR_ACTIVITY_AUDIT_TRAIL.ACTIVITY_TYPE} = "Benefits QA Review" and
{V_BAR_ACTIVITY_AUDIT_TRAIL.DATE}={?Date} and
{V_BAR_SR.PG_CLIENT} = "Y" and
{V_BAR_SR.RELATED_TO_PROJECT} <> "Y" and
{V_BAR_SR_ACTIVITY.ACTIVITY_TYPE_CD} = "Benefits Coding"
The output that I'm getting on the report is every permutation of the TAT from the combinations of the start dates and end dates when the users marked the activities more than once. Yuck-o.
When I try using the Minimum or Maximum function in the TAT calculation, I get an error message.
I'm using CR 11.0.0.895.
How do I go about fixing this?
Thanks!!!