I have an app where users enter patients entered into the hospital. The patient can't be at two locations at once with overlapping dates. I am pulling all the patient's records in my source into a collection and when the user selects a date in the ArrivalDate field, it is changing the date to an integer to compare the dateints of the database and my variable date int. Some times this formula works and brings back all records that have overlapping dates, but sometimes it doesn't. I'm not sure why this happens sometimes and not other times.
UpdateContext(
{
varArrivalDate: Value(
Text(
dt_ArrivalDate.SelectedDate,
"yyyymmdd"
)
)
}
);
ClearCollect(
colPossibleDuplicates,
Filter(
colPatientsCurrentRecords,
PatientTrackerID <> Value(txt_ID.Text)
&& ((ArrivalDateInt = varArrivalDate)
|| (ArrivalDateInt <= varArrivalDate && DischargeDateInt = Blank())
|| (ArrivalDateInt <= varArrivalDate && DischargeDateInt >= varArrivalDate))
)
);