cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Lewkir
Level: Powered On

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
Level: Powered On

Re: Filtering with Multiple Or statements

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
Level: Powered On

Re: Filtering with Multiple Or statements

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 408 members 6,053 guests
Please welcome our newest community members: