×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Days Calculated through a selection of records

Days Calculated through a selection of records

Days Calculated through a selection of records

(OP)
Help!!

I'm using Crystal Reports 2011

I have a report which reports the number of days a support ticket has been open. within my database, there is a history table that contains ststus changes within the support ticket. I need to be able to calculate the number of days that the support ticket has been in a 'Pending' state.

The table has fields entry_date and entry_text and the text contains 'Status changed from Open to Pending' and 'Status changed from Pending to Open' and there could be multiple times where the ticket changed between Open and Pending.

How do I loop through the records and calculate the pending days?

Any assistance in the way forward would be appreciated!

Thanks

Steve

RE: Days Calculated through a selection of records

Make sure records are sorted ascending by {table.entry_date}. Create a formula like this and put it in the detail section:

Whileprintingrecords;
Datevar start := date(9999,9,9);
Datevar end := date(0,0,0);
Numbervar pending;

If “Open to Pending” in {table.entry_text} then
start := {table.entry_date};
If “Pending to Open” in {table.entry_text} then
end := {table.entry_date};
if not onfirstrecord and
start < end then
pending := pending + end-start;
If onlastrecord and
end < start then
pending := pending + currentdate-start;
pending

In the report footer add the display formula:

Whileprintingrecords;
Numbervar pending;

Be sure to replace my quote marks with your own if you copy the formula.

-LB

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close