Login / Register  search  syndication

          George Jensen's Blog

George Jensen on Reporting, Business Intelligence, Crystal Reports, Visual Analyzer, and more.

Working with the DatePart Function in Crystal

This function is very popular one that allows you to organize your data based on Dates.

The basic syntax for the function looks like this:

DATEPART( Interval Type, InputDateTime)

A more realistic example:

DatePart ("m",{ACTIVITY.STARTDATE})

This will return the month of each Activity is scheduled in.  Please note the interval type is surrounded by double quotes.

Here is a list of the Interval Types from Crystal Report On line Help (Highlight the function and select the ? from the Formula Workshop Tool bar)

Interval type value Description

yyyy

Extracts the year

q

Quarter (the result is 1, 2, 3 or 4)

m

Month (the result is from 1 to 12)

y

Day of year (1 to 365 or 366 in a leap year)

d

Day part of the date (1 to 31)

w

Day of week (1 to 7 with the result depending on firstDayOfWeek)

ww

Week of year (1 to 53 with firstDayOfWeek and firstWeekOfYear determining the exact days of the first calendar week of the year)

h

Extracts the hour part of the given DateTime (0 to 23)

n

Minute part (0 to 59)

s

Second part (0 to 59)

So if I wanted to create a record for all of the Activities scheduled for this week and the next week, I could write the following as a select Criteria.

DatePart("yyyy",{ACTIVITY.STARTDATE}) = datepart("yyyy",CurrentDate)
and
(DatePart("ww",{ACTIVITY.STARTDATE}) = datepart("ww",CurrentDate)
or
DatePart("ww",{ACTIVITY.STARTDATE}) = datepart("ww",CurrentDate)+1)

Cool stuff, More next week.  Thanks for reading.

See a list of SalesLogix Reports updated by Customer FX, follow this link

What's This?
Bookmark and Share

About George Jensen

   George Jensen is a Senior Developer for Customer FX Corporation.


Related Content
   SalesLogix Web Client- Marketing Campaigns Part I [Video]
In this video webinar the Marketing Professional will learn how to create a New Marketing Campaign in Sal
Posted on Mar 15, 2010 by Dale Richter to SalesLogix Training
 
   Searching for Matching Records in the SalesLogix Web Client
In this short video the user will learn how to search for matching records while adding new records to th
Posted on Mar 10, 2010 by Dale Richter to Tech Talk
 
   Opening Several Records in the SalesLogix Web Client
This webinar will show the user how to open several records at one time. Often you would like to be able
Posted on Mar 10, 2010 by Dale Richter to SalesLogix Training
 
   The "What's New" Feature in SalesLogix Web Client
This webinar will focus on the functionality of the "What's New" Feature. This feature all
Posted on Mar 10, 2010 by Dale Richter to SalesLogix Training
 
   Converting a Lead in SalesLogix Web Client
This webinar will teach the user how to convert a Lead into an Account/Contact in your database. Leads a
Posted on Mar 10, 2010 by Dale Richter to SalesLogix Training
 
Comments

 

Twitter Trackbacks for Working with the DatePart Function in Crystal - George Jensen [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 Working with the DatePart Function in Crystal - George Jensen         [customerfx.com]        on Topsy.com

November 19, 2009 10:23 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2010 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register