cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User
Super User

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

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

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

 

 

 

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.

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (68,565)