cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FelipeCaru
Advocate V
Advocate V

Load galleries and some formulas before using a button or from start

Hello all,

I have a question. Is it possible to have some gallery or formulas to load when the app is opened? or in a screen before it? Asking this because in my app I have the following:

  • Home: choose criteria
    • Criteria: this month - choose starts this month / ends this month
      • Start/end this month screen

However, in the second one I have a popup that if there is no item in the next gallery, popup saying so:

If(CountRows(galleryIMA.AllItems)<>0, Navigate(inicianMesActual,ScreenTransition.Cover), UpdateContext({Popup:true}))

However, did a test today and when the app was opened fresh from a new session in other browser, the button when clicked showed the popup with "no item", however, when clicked again, it went to the screen with the gallery which does have items, which makes me think that it was because the formula was not calculated before. This leads me to the question: is it possible to "preload" somewhere else (before this) that formula or gallery, as to avoid that error?

1 ACCEPTED SOLUTION

Accepted Solutions

I managed to solve this by having the formula on the "OnStart" of the app, with the "OnStart" being = 

CountRows(galleryIMA.AllItems)

That way it is already calculated before clicking the button, thus avoiding having a false positive pop up. 

View solution in original post

2 REPLIES 2
FelipeCaru
Advocate V
Advocate V

Add-on Q:
Having the same formula but replacing the CountRows(x) with a variable, work? Such as:

If(CountRows(VARIABLE)<>0, Navigate(inicianMesActual,ScreenTransition.Cover), UpdateContext({Popup:true})

With variable = 

galleryIMA.AllItems

So, on AppStart that would happen so later the screen doesnt has to calculate again and avoid the false positive of the popup?


I managed to solve this by having the formula on the "OnStart" of the app, with the "OnStart" being = 

CountRows(galleryIMA.AllItems)

That way it is already calculated before clicking the button, thus avoiding having a false positive pop up. 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,822)