cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Imke
Advocate III
Advocate III

Problems with initialized variables not being populated OnStart

Hi there,
I am having a problem with my variables that I have defined in the OnStart property of the App: Suddenly, they are not populated/shown when I run the published app.

While the first variable shows at least in edit mode, the second doesn't show at all in edit-mode. (After I have hit "Run on start"):

Imke_0-1670415397374.png

But what is totally strange is, that after publishing, even the first variable doesn't show any more:

Imke_1-1670415436349.png

 

I am using a (manual) timestamp to check that I am seeing the currently published version to rule out any caching issues or so.
I am also running the app in the default-modus, so without any parameters. Until half an hour or so, the variables showed up alright and although I (believe) didn't change anything, they started to return empty suddenly.
Has anyone seen such a thing before or has any clue what might have caused it / how to overcome?

Thanks heaps!!

3 ACCEPTED SOLUTIONS

Accepted Solutions

My advice is to have a loading screen - make that your first screen, then on its OnvVsible, perform the functions you are currently using OnStart for - then at the end of that OnVisible you navigate to the screen based on your params as you are currently doing - this way you can always be sure it will complete before you reach the required screen 🙂

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Yes I remember they changed that so you can't do the navigate from OnVisible - make a button, make it invisible

then on the OnVisible where you had the Navigate('MyStartScreen') instead put Select(ButtonName) and make the OnSelect of the button Navigate('MyStartScreen') 🙂

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Yes, I can help with that

 

To break the formula and prevent it from autonavigating so that you can get back to the page, you can use the search-and-replace and then replace one character in your Navigate('MyStartScreen') - this will break it and allow you to get back to the page

 

To stop it happening in future, you can create an auto-load variable during OnStart:

Set(gblAutoLoad, true)

This way you can set it to false using the App OnStart editor without having to navigate to the loading screen.

Then on your button instead of just Navigate('MyStartScreen') you have :

If(gblAutoLoad, Navigate('MyStartScreen'))

 

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

10 REPLIES 10
iAm_ManCat
Super User
Super User

Do you have 'non-blocking OnStart' turned on for the App? It may be that your other formulae are finishing/running before the OnStart has completed.

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


I would advise doing most of your code on the first screen's OnVisible instead.

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Imke
Advocate III
Advocate III

Thanks @iAm_ManCat !
Yes, that feature is set.
The entry point for this app can be different screens (using deep links sent via Outlook from Flow) and I don't want to duplicate logic. So App-level seemed the best option for me.

But I am a beginner, so thankful for any advise.

 

My advice is to have a loading screen - make that your first screen, then on its OnvVsible, perform the functions you are currently using OnStart for - then at the end of that OnVisible you navigate to the screen based on your params as you are currently doing - this way you can always be sure it will complete before you reach the required screen 🙂

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Imke
Advocate III
Advocate III

That sounds like a great advise!
Thanks a lot @iAm_ManCat , will try that out.

Imke
Advocate III
Advocate III

Hi @iAm_ManCat ,
after adding the last command "Navigate('MyStartScreen') to the "OnVisible"-property of the loading screen, I am getting this error:

Imke_0-1670614209796.png

Any idea what I might do wrong here?

 

Yes I remember they changed that so you can't do the navigate from OnVisible - make a button, make it invisible

then on the OnVisible where you had the Navigate('MyStartScreen') instead put Select(ButtonName) and make the OnSelect of the button Navigate('MyStartScreen') 🙂

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Imke
Advocate III
Advocate III

Thanks, did as advised but got myself into trouble:
Now I cannot select/edit the loading screen any more, because there is some auto-play going on here:
Once I try to select the screen or any of its elements, the automatic forwarding to my start screen is happening here in edit mode as well. I cannot click fast enough to delete the button for example.
Do you have any idea where I can turn that off, so that I can edit or at least check my code on that page?

Yes, I can help with that

 

To break the formula and prevent it from autonavigating so that you can get back to the page, you can use the search-and-replace and then replace one character in your Navigate('MyStartScreen') - this will break it and allow you to get back to the page

 

To stop it happening in future, you can create an auto-load variable during OnStart:

Set(gblAutoLoad, true)

This way you can set it to false using the App OnStart editor without having to navigate to the loading screen.

Then on your button instead of just Navigate('MyStartScreen') you have :

If(gblAutoLoad, Navigate('MyStartScreen'))

 

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


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 (3,496)