• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Need help in writing a Crystal reports formula


I have a data printing as shown below.  My report is grouped by Ticket Number.  I have shown the details section of one ticket no.

Ticket No         Type                   Duration Time
 IM44-00256    Initial                    0.00
 IM44-00256    Upgrade              0.00
 IM44-00256    Downgrade         5.25
 IM44-00256   Downgrade         6.62
 IM44-00256  Upgrade              2.00
  IM44-00256   Resolved            3.35

What I need to write is a formula that just SUM the Duration time of 2nd Downgrade = 6.62 and the Resolved = 3.35.

 The concept behind this is, if there's an Type = upgrade and the previous type = "Downgrade" then get the Duration Time and add to DurationTime of type = "Resolved" and show it in the group footer of each ticket number. If there's no "Upgrade" after a Type "Downgrade" then just show the DurationTime of Type = "Resolved"

Please assist .

Thank you

1 Solution
Try this :

1.write a formula and place it Group Header and suppress

numbervar num ;

2. write a formula and place it Details and suppress

numbervar num ;
if {Type} = "upgrade" and the previous ({type}) = "Downgrade" then
num := num + {Duration Time}
else if {Type} = "Resolved " then
num := num + {Duration Time}

3. write a formula and place it Group Footer and show
numbervar num ;

======if your time is not number ,then change "numbervar" to "
timevar" in all of above formulas========

angel7170Author Commented:
Perfect! This works awesome!

I just have a slight modification because if Type = "Resolved" it should be as

num := {Duration Time}

Thank you very much
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now