cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lewkir
Resolver I
Resolver I

Filtering with Multiple Or statements

Hi,

 

I'm trying to Filter a Sharepoint List of Bookings based on whether the start and finish time of each booking falls within a time already booked. The times are stored as number values in the format: YYYYMMDDhhmm.

 

Filter(
                'Booking List',
                (FromCalcFlow < Value(FromDateAsNumber.Text) &&  
                ToCalcFlow >= Value(FromDateAsNumber.Text))  //Checks if start time is outside selected dates and end time within them
Or 
                (FromCalcFlow > Value(FromDateAsNumber.Text) &&
                FromCalcFlow < Value(ToDateAsNumber.Text) &&
                ToCalcFlow > Value(FromDateAsNumber.Text) &&
                ToCalcFlow < Value(ToDateAsNumber.Text)) Checks if Both start time end time is within selected dates 
Or
                (FromCalcFlow >= Value(ToDateAsNumber.Text) &&  
                ToCalcFlow > Value(ToDateAsNumber.Text))) //Checks if start time is inside selected dates and end time outside them

The problem is powerapps seems to ignore the first two conditions and only evaluate for the ToCalcFlow > Value(ToDateAsNumber.Text part of the 3rd.

 

Meaning it only returns bookings that have a To date later than both selected dates.

 

Is there a way to make it evaluate them all?

 

Cheers,

1 ACCEPTED SOLUTION

Accepted Solutions
Lewkir
Resolver I
Resolver I

Figured it out a > was the wrong way round.

Filter(
                'Booking List',
                (FromCalcFlow < Value(FromDateAsNumber.Text) &&   
                ToCalcFlow >= Value(FromDateAsNumber.Text)) Or 
                (FromCalcFlow > Value(FromDateAsNumber.Text) &&
                FromCalcFlow < Value(ToDateAsNumber.Text) &&
                ToCalcFlow > Value(FromDateAsNumber.Text) &&
                ToCalcFlow < Value(ToDateAsNumber.Text)) Or
                (FromCalcFlow <= Value(ToDateAsNumber.Text) &&  
                ToCalcFlow > Value(ToDateAsNumber.Text))
      )

View solution in original post

1 REPLY 1
Lewkir
Resolver I
Resolver I

Figured it out a > was the wrong way round.

Filter(
                'Booking List',
                (FromCalcFlow < Value(FromDateAsNumber.Text) &&   
                ToCalcFlow >= Value(FromDateAsNumber.Text)) Or 
                (FromCalcFlow > Value(FromDateAsNumber.Text) &&
                FromCalcFlow < Value(ToDateAsNumber.Text) &&
                ToCalcFlow > Value(FromDateAsNumber.Text) &&
                ToCalcFlow < Value(ToDateAsNumber.Text)) Or
                (FromCalcFlow <= Value(ToDateAsNumber.Text) &&  
                ToCalcFlow > Value(ToDateAsNumber.Text))
      )

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,059)