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

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
EricLott
Level 10

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
EricLott
Level 10

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

apsuk
Level: Powered On

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

 

 

 

EricLott
Level 10

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.

apsuk
Level: Powered On

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
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,137)