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

Record Selection Based on Date to Date Interval 1

Status
Not open for further replies.

MochaLatte

Technical User
Jan 11, 2011
39
US
I need to select records (visitors) based on specific months and count numb days of stay.
For example, I need to select all visitors who stayed in our facility in the month of July and calculate the number of days/stay in July.

Visitor A : Visit begins in June 15 and Visit ends in August 10
Visitor B: Visit begins in July 20 ends in August 8


Thank you!!!!

 
Use a selection formula like this:

{table.admitdate} < {?End}+1 and
{table.dischargedate} >= {?Start}

Then use a formula in the field explorer like this to count the days:

if {table.admitdate} < {?Start} and
{table.dischargedate} > {?End} then
datediff("d",{?Start},{?End}) else
if {table.admitdate} < {?Start} and
{table.dischargedate} < {?End}+1 then
datediff("d",{?Start},{table.dischargedate}) else
if {table.admitdate} >= {?Start} and
{table.dischargedate} < {?End}+1 then
datediff("d",{table.admitdate},{table.dischargedate}) else
if {table.admitdate} >= {?Start} and
{table.dischargedate} > {?End} then
datediff("d",{table.admitdate},{?End})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top