Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bi-yearly date formula

Status
Not open for further replies.

RCCRookie

Technical User
Jul 3, 2007
29
0
0
US
I have been instructed to create a report showing, in line chart form, the number of Corrective Action Requests over 5 years shown in 6 month increments. I should have 10 data points on the chart. I know very little about writing formulas least of all formula's using variables. I'm using Crystal XI and a SQL database. Can anyone provide assistance? I've added the formula I'm using below:

local datevar FieldDt;
if isnull({CORRECTIVE_MNT_V.SYMP_DATE}) then FieldDt:=date(1900,01,01) else
FieldDt:=date({CORRECTIVE_MNT_V.SYMP_DATE});

//Bi-Yearly
if datediff('D', {?Pm-@LowerDate}, {?Pm-@UpperDate}) <= 1825 then
totext(Year(FieldDt),0,"") + '-' +
(This is the point where I'm lost) right(('000' + totext

I would like the graph to display "1st Half 2XXX" or "2nd Half 2XXX" for each of the 5 years displayed. I simply don't know how to format the formula to return the text "1st Half 2XXX or 2nd Half 2XXX depending on which half the month falls. Currently my graph returns, for example 01/2004 7/2004 1/2005 7/2005 etc.
 
if datepart('q',{table.date}) in [1,2] then '1st Half ' + year({table.date}) else
if datepart('q',{table.date}) in [3,4] then '2nd Half ' + year({table.date})

As a formula to group by for charting purposes this should get you what you need.

'J

CR8.5 / CRXI - Discovering the impossible
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top