Monday, January 27, 2014

Crystal Reports : Calculating Age

One of the many things you will want to do with a bona-fide date field is calculate age.
Crystal makes it easy for us here; as long as we're comparing two date type fields, we can perform simple math.
Let us suppose that the date field in question is {CONTACTS.SOURCEDATE}, which represents when a particular prospect was imported into our database.

1. We can see how many records were imported in the last seven days

{CONTACTS.SOURCEDATE} <= CurrentDate() - 7

2. Or how "old" any particular record is, expressed in days

CurrentDate() - {CONTACTS.SOURCEDATE}

3. To calculate the age in years, we must use the Crystal DateDiff function:

DateDiff("yyyy", {CONTACTS.SOURCEDATE}, CurrentDate())

The "yyyy" specifies we want the answer in years; "m" and "d" are also options (months and days, correspondingly)

3 comments:

Anonymous said...

All the other, fake chanel bags things savored a good rich validation utilizing costumers. All this results was initially necessary: consistency, integrity, compactness included to amazing fake chanel actualization what precisely elsewhere may well attraction users? Folks that is unable to make it easy for omega replica uk really should not troubled. One can find very best first-class omega replica uk, that can be for positively good price tags. A good patterns are sometimes made is definitely accurate archetype within the aboriginal and this continuously produces a clientele enrolled in attractive, avant-garde together with omega replica uk.

Harry smith said...

Its provide us with plenty of interest and pleasure. Its chance are actually fantastic and style so fast. Its a genuine bit of content. It generates for me lots of pleasure and interest. Awesome job and keep on sharing. hang tags supplier

Harry smith said...

Your post is really very good and I appreciate it. It’s hard to sort the good from the bad sometimes, but I think you've nailed it. You write very well which is amazing. I really impressed by your post. Watford removals services