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.