cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
apsuk
Regular Visitor

How make an Item Visible in a Gallery if some criteria is met in any record of a Table using ForAll or LookUp

Hi,

 

More specifically the I want dates in a calendar to be highlighted, if they lie between ReservedFrom and ReservedUntil dates in a Bookings Table for the selected ProductID. The purpose is that it will show the user what dates the Product is currently unavailable in the month currently being viewed.

 

I've used this Calendar  tutorial as my starting point. Ive renamed HolidayCircle to BookedCircle and I am now trying to set the BookedCircle.Visible event to be true or false, if the date that the circle object represents, determined using formula,

 

 

DateAdd(_firstDayInView,ThisItem.Value,Days)

 

 

is between ReservedFrom and ReservedUntil in a ForAll statement.

 

The issue is that the ForAll doesn't return a single Boolean value.

 

Does anyone have any suggestions about how i could tackle this one?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
apsuk
Regular Visitor

Thanks @EricLott 

 

I just worked out a different way by setting BookedCircle.Visible to be:

 

!IsBlank(LookUp(Bookings, And(DateAdd(_firstDayInView,ThisItem.Value,Days) >= ReservedFrom, DateAdd(_firstDayInView,ThisItem.Value,Days) <= ReservedUntil), BookingId))

 

 

This returns either true or false if the Date that the Circle represented is between ReservedFrom and ReservedTo in ANY of the records. If no records are returned, the Table is therefore blank.

 

Would your suggestion of using AddColumns perform better under certain conditions for any reason?

View solution in original post

2 REPLIES 2
EricLott
Resident Rockstar
Resident Rockstar

Try using the AddColumns() function. It will let you tack on a column to your data which you can set to an if statement which checks the date range.
apsuk
Regular Visitor

Thanks @EricLott 

 

I just worked out a different way by setting BookedCircle.Visible to be:

 

!IsBlank(LookUp(Bookings, And(DateAdd(_firstDayInView,ThisItem.Value,Days) >= ReservedFrom, DateAdd(_firstDayInView,ThisItem.Value,Days) <= ReservedUntil), BookingId))

 

 

This returns either true or false if the Date that the Circle represented is between ReservedFrom and ReservedTo in ANY of the records. If no records are returned, the Table is therefore blank.

 

Would your suggestion of using AddColumns perform better under certain conditions for any reason?

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!

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.

Top Solution Authors
Users online (1,399)