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

"Equals" Part of Formula Not Working When Comparing 2 Dates

Status
Not open for further replies.

dazum

Technical User
Apr 6, 2011
57
US
I have a 3 part formula that I am hoping to get the minimum Legal Date that is greater or equals to the maximum Start Date. The formula works OK until it get to a record where the minimum Legal Date is equals to the maximum Start Date then no date shows. Below is the 3 parts of the formula;

//Group Header Formula:
whileprintingrecords;
datetimevar minlegal;
if not inrepeatedgroupheader
then
minlegal := date(0,0,0)

//Details Formula (suppressed):
whileprintingrecords;
datetimevar maxstart := maximum({CASE_STATUS.BEGIN_EFF_DATE},{CASE_BASE.CASE_ID});
datetimevar minlegal;
if {LEGAL_BASE.OFFICIAL_DATE} >= maxstart
then
minlegal := {LEGAL_BASE.OFFICIAL_DATE};
if {LEGAL_BASE.OFFICIAL_DATE} >= maxstart and
{LEGAL_BASE.OFFICIAL_DATE} < minlegal
then
minlegal := {LEGAL_BASE.OFFICIAL_DATE};

//Group Footer Formula:
whileprintingrecords;
datetimevar minlegal;

Is there something that needs to be added to the formula the get the dates that are equal to show?
I am using CR 11
 
//Group Header Formula:
whileprintingrecords;
datetimevar minlegal;
if not inrepeatedgroupheader
then minlegal := date(9999,9,9)

//Details Formula (suppressed):
whileprintingrecords;
datetimevar maxstart := maximum({CASE_STATUS.BEGIN_EFF_DATE},{CASE_BASE.CASE_ID});
datetimevar minlegal;
if {LEGAL_BASE.OFFICIAL_DATE} >= maxstart and
{LEGAL_BASE.OFFICIAL_DATE} < minlegal then
minlegal := {LEGAL_BASE.OFFICIAL_DATE};

-LB
 
lbass
I've figured out the problem but still need help with the formula.
My dates are in "DateTime" format. One of the Status Dates is 10/23/10 2:00 PM and the Legal Date is 10/23/10 12:00 AM, so the formula is working.
Within the details part of the formula I tried declaring the variables as "datevar" but it give the error "A Date is Required Here", by the "maximum({Case_Status.Begin_EFF_DATE},{CASE_BASE.CASE_ID})" line in the details part of the formula.
Is there a way to adjust the formula to just compare the dates of the maxStatusDate and the minLegal date and not the date and times?
 
Please change your formulas as I showed--otherwise you will be automatically setting the date to the one in the current row. Change the formulas to:

//Group Header Formula:
whileprintingrecords;
datevar minlegal;
if not inrepeatedgroupheader then
minlegal := date(9999,9,9)

//Details Formula (suppressed):
whileprintingrecords;
datevar maxstart := date(maximum({CASE_STATUS.BEGIN_EFF_DATE},{CASE_BASE.CASE_ID}));
datevar minlegal;
if date({LEGAL_BASE.OFFICIAL_DATE}) >= maxstart and
date({LEGAL_BASE.OFFICIAL_DATE}) < minlegal then
minlegal := date({LEGAL_BASE.OFFICIAL_DATE});

//Group Footer Formula:
whileprintingrecords;
datevar minlegal;

-LB
 
Thanks lbass for all your help! I'm getting the correct results from the comparisons of the dates now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top