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
Super User
Super User

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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
Top Kudoed Authors
Users online (3,251)