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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choosing a date

Status
Not open for further replies.

c8ltgkue

MIS
May 1, 2007
57
GB
Using CR XI

My data looks as below

GH -4242 (tblPerson.PersonID)

Case ID Date Received Date Completed
D-1111 01 Feb 07 31 May 07
D-1112 03 June 07 01 Aug 07
D-1113 09 Sept 07 02 Feb 08


Data is grouped by personID. A person could be on more than one case. I am trying to find the date difference between the first date in year 2007-2008(Year starts at 1stApril and ends at 31st March).

In the above case it will be 03 June 07. I can’t use the straight forward Minimum() function as it will give me 01 Feb 07 which is outside Apr 07-March08.

To achieve this I created a shared variable called flag. I am resetting flag in report header.

@ResetFlag

Shared NumberVar Flag;

Flag:=0

I have created a formula called @MinDate to find out the minimum date in year 2007-08.

@MinDate

Shared DateTimeVar MinDt;
shared NumberVar Flag;


if {tblCase.DateReceived} >= DateTime (2007, 04, 01, 00, 00, 00) and Flag = 0 then
MinDt:= {tblCase.DateReceived};
flag:=flag+1;


The above formula returns 09 Sept 07 from the above example which is the wrong date. Please could you spread some light on what I am doing wrong. ?

Many thanks
C8
 
You need to use parens:

Shared DateTimeVar MinDt;
shared NumberVar Flag;

if {tblCase.DateReceived} >= DateTime (2007, 04, 01, 00, 00, 00) and
Flag = 0 then (
MinDt:= {tblCase.DateReceived};
flag:=flag+1
);

But why not limit the records to start at the beginning of the fiscal year in the first place?

-LB
 
Thanks for your help lbass

I am not limiting the data because the next step is to find the time difference in months between MinDate and any Date Completed before that date. i.e. In the above example MinDate= 03 June 07. So I want to know the difference in month between 03 June 07 and 31 May 07 ( Case# 1111)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top