formula help (1 Viewer)

jedder18

Just Livin the Dream!
Local time
Today, 14:04
Joined
Mar 28, 2012
Messages
135
using this formula in a report.
selecting 3/1/19 as beginadmitdate and 3/31/19 endadmitdate
if the fields in report have dates in those ranges in some fashion, the formula works,
however,
the last formula is not calculating the diff if the dates do not fall in any of the above arrays.
ex: 2/19/19 thru 4/15/19 should display 31 days since it's b4 the begindate and after the enddate...
it is calculating the whole time frame as 56 days.
any help, really appreciated.
:banghead:

if isnull ({history_bed_assignment.end_date_of_bed_assignment}) or
{history_bed_assignment.end_date_of_bed_assignment}>{?EndAdmitDate}and
{history_bed_assignment.date_of_bed_assignment}>={?BeginAdmitDate} then
Datediff("D",{history_bed_assignment.date_of_bed_assignment},{?EndAdmitDate}+1)
else
if ({history_bed_assignment.date_of_bed_assignment})<{?BeginAdmitDate} and
{history_bed_assignment.end_date_of_bed_assignment} in {?BeginAdmitDate} to {?EndAdmitDate} then
Datediff("D",{?BeginAdmitDate},{history_bed_assignment.end_date_of_bed_assignment}+1)
else
if ({history_bed_assignment.date_of_bed_assignment})<={?EndAdmitDate} and
{history_bed_assignment.end_date_of_bed_assignment}>={?BeginAdmitDate} then
Datediff("D",{history_bed_assignment.date_of_bed_assignment},{history_bed_assignment.end_date_of_bed_assignment}+1)
else
if {history_bed_assignment.date_of_bed_assignment}<{?BeginAdmitDate}and
isnull ({history_bed_assignment.end_date_of_bed_assignment} )or
{history_bed_assignment.end_date_of_bed_assignment} > {?EndAdmitDate}
then
Datediff("D",{?BeginAdmitDate},{?EndAdmitDate}+1)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom