cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sesese
Helper III
Helper III

Update Context for the visibility of an item doesn't work on start but only when change page

Hey guys,

 

In my app at the OnStart I've set a ClearCollect function and at OnVisible of the "Home" page there's a formula to set the visibility of a gallery based on a filtered countrows.

 

OnStart: ClearCollect(bookinglist,'DB-Booking')

OnVisible-Home: If(CountRows(Filter(bookinglist,Mail=Label6.Text,Day=Label6_1.text))=0,UpdateContext({visible:false}),UpdateContext({visible:true})

 

Home formulas

Visible-Gallery: visible

Label6= Text(Today(),"dd/mm/yyyy")

Label6_1=User().Email

 

When I start the app the gallery doens't load but when i move to another page then come back it appers.

 

Any tips?

Many thanks

3 REPLIES 3
Drrickryp
Super User
Super User

@Sesese 

 Your formula for OnVisible home is missing a ")" at the end for the If() function.

   If(
       IsEmplty(
                 Filter(
                         bookinglist, Mail=Label6.Text, Day=Label6_1.text
                 )
        ), UpdateContext({visible:false}), UpdateContext({visible:true})
   )

 

Hi @Drrickryp ,

 

thank you for your answer, I've changed the formula according to your suggestions but it still doesn't work when the page loads but only when I come back to the home page after navigating to another one

Hi @Sesese ,
You have a refreshing /calculation order issue there - forget about the labels and do this (also visible is not a good name for a Variable)

UpdateContext(
   {
      visible:
      CountRows(
         Filter(
            bookinglist,
            Mail = User().Email && 
            Day = Text(Today(),"dd/mm/yyyy")
         )
      ) > 0
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,822)