web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Date Control Onchange ...
Power Apps
Answered

Date Control Onchange Property Not working All the Time

(0) ShareShare
ReportReport
Posted on by 38

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))
)
);

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @pb37087 ,

     

    The second formula makes me confused. Please try below instead if you would like to filter out records that the length of hospital stay of a specific patient does not include the selected date.

    ClearCollect(
     colPossibleDuplicates,
     Filter(
     colPatientsCurrentRecords,
     PatientTrackerID = Value(txt_ID.Text) && (ArrivalDateInt <= varArrivalDate && (DischargeDateInt = Blank() || DischargeDateInt >= varArrivalDate))
     )
    );

     

    If nothing has been filtered out, then either there is no hospitalization record belong to this patient, or the length of hospital stay of this patient includes the selected date.

     

    Best regards,

  • pb37087 Profile Picture
    38 on at

    I appreciate the reply and didn't realize that my filter could have been combined. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 993

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 545

Last 30 days Overall leaderboard