cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
apsuk
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
EricLott
Resident Rockstar
Resident Rockstar

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
Resident Rockstar
Resident Rockstar

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
Regular Visitor

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
Resident Rockstar
Resident Rockstar

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
Regular Visitor

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,396)