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

How to check if shape objects in a gallery are visible or not.

Hi

 

Using the Interactive Calendar example from here, There is a gallery called CalendarGallary containing a text box and two circles for each day. I want to add a Button that checks if,

 

 

HolidayCircle.Visible = true, 
and 
DaySelectedCircle.Visible = true

 

 

for every date in the gallery and then change the variable ValidMsgBoxState to "Yes" if this condition is met. 

 

EDIT: Ive now got something that i think should work but doesn't any ideas why?

I set Button1.onSelect to :

 

If(IsBlank(
  LookUp(CalendarGallery.AllItems, 
  And([@HolidayCircle].Visible = true,[@DaySelectedCircle].Visible = true), 
  [@HolidayCircle].Visible)),
  UpdateContext({ValidMsgBoxState:"Yes"}))

 

 

Your help much appreciated.

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resident Rockstar
Resident Rockstar

Re: How to check if shape objects in a gallery are visible or not.

This took some time, but I ended up using the formula in the circle's Visible property instead of trying to reference if it's actually visible.

Clear(MyTestCollection);
ForAll(CalendarGallery.AllItems,Collect(MyTestCollection,{Day:Day(DateAdd(_firstDayInView,Value,Days)),ValidMsgBoxState:If(And(DateAdd(_firstDayInView,Value,Days) in _holidays,_selectedCount > 0 &&
DateAdd(_firstDayInView,Value,Days) >= _selectionStart &&
DateAdd(_firstDayInView,Value,Days) <= _selectionEnd),"Yes","No")}))

This returns this result:

2020-01-16 11_35_07-Inventory Tracking - Saved (Unpublished) - Power Apps.png 

View solution in original post

4 REPLIES 4
Highlighted
Resident Rockstar
Resident Rockstar

Re: How to check if shape objects in a gallery are visible or not.

This took some time, but I ended up using the formula in the circle's Visible property instead of trying to reference if it's actually visible.

Clear(MyTestCollection);
ForAll(CalendarGallery.AllItems,Collect(MyTestCollection,{Day:Day(DateAdd(_firstDayInView,Value,Days)),ValidMsgBoxState:If(And(DateAdd(_firstDayInView,Value,Days) in _holidays,_selectedCount > 0 &&
DateAdd(_firstDayInView,Value,Days) >= _selectionStart &&
DateAdd(_firstDayInView,Value,Days) <= _selectionEnd),"Yes","No")}))

This returns this result:

2020-01-16 11_35_07-Inventory Tracking - Saved (Unpublished) - Power Apps.png 

View solution in original post

Highlighted
Regular Visitor

Re: How to check if shape objects in a gallery are visible or not.

Hi 

Thanks for this, i'll take a look - which circle's visible property did you use? the DaysSelectedCircle or the HolidaysCircle ??

 

Does it is still work if the start and end date are different months? I assume it does as your referencing _holidays collection?

 

Thanks

 

 

 

Highlighted
Resident Rockstar
Resident Rockstar

Re: How to check if shape objects in a gallery are visible or not.

Both. It's whether holiday and selected are visible as in your previous post.

I did not test it on days spanning multiple months.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

Highlighted
Regular Visitor

Re: How to check if shape objects in a gallery are visible or not.

Hi @EricLott, ive marked it as a solution because it does answer the question, however i realised that it was a bad question because your solution only works if the slected date range start and ends in the same month, which is a result of using the ciricle.visible feature.

 

I have now constructed a more generalised question, the solution to which should provide a more robust and transferable implementation. Please check it out at : https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-check-if-a-list-of-dates-conflicts-wi...

 

Thanks

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,042)