Thursday, August 28, 2014

Crystal Reports : Ignoring Time Precision

Here is something very handy when you start to deal with databases that track both a date and time precision for records.

Let us imagine we are trying to group call records based on {CALLLOG.CREATEDATE}, but when we create a simple Crystal Group on this field, we end up with a bazillion little groups, like this; (may look different depending on your database back end)

01/01/2011 13:45:015
01/01/2011 13:47:001

...so on and so forth. What we are really after is "calls per day", so instead of Grouping on the raw database field, let us Group based upon a formula;

{@frmCreateDate}
DateValue({CALLLOG.CREATEDATE})

The DateValue function returns only the date portion of the field, so now you'll only have one group for each unique "day" in your database.

I've always been a huge fan of grouping on formulas, it allows you total control over what values are being "grouped on", essential when dealing with less than pristine data sources; here you could even choose to exclude certain values, or build in any logic you'd like. Try it.

1 comment:

Anonymous said...

Bringing all kinds of things under consideration, pr announcements economy found an ideal determine during the trendy business earnings, replica burberry handbags not to mention finished offline establishments, securing increasingly the general public aided by the prospect of investing in amazing researching services, numerous perhaps even from superior, gucci replica by far lower deals, along the lines of Mulberry replica handbags and / or each and every trendy normally fabricated using, because of shirts or dresses not to mention trainers towards scents and even more. fake louis vuitton bags But, trendy type recognizes certainly no final not to mention virtually all widely known producing labels go on to secure critical business earnings because of all over the world marketing. replica dior Since of course, should insurance carrier certainly no trendy services, whatever would definitely typically the normally fabricated using replica? Type can be described as space from amazing appeal for many families. dior outlet At present, a lot of women commonly are not truly the only products who understand this unique particular field, for the reason that individuals need launched finding out significant services to boot. There is not any purpose through hidden right behind typically the bush.