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

BUG: Can't start app because OnStart() code gets messed up in international setting (e. g. German)

With the current version (3.19043.16), saving the app messes up the OnStart() code.

 

My code:

Set(MyUserId;Office365Users.MyProfile().Id);;
Set(HomeTimerStartTime;Now());;
Set(UTCNow;Today());;
Set(UTCNext;DateAdd(UTCNow;2;Days));;

When I save and reopen the app, the OnStart code has changed to:

Set(MyUserId;;Office365Users.MyProfile().Id);;;;
Set(HomeTimerStartTime;;Now());;;;
Set(UTCNow;;Today());;;;
Set(UTCNext;;DateAdd(UTCNow;;2;;Days));;;;

which prevents the app from starting.

 

Even if I try to change that to the US format:

Set(MyUserId,Office365Users.MyProfile().Id);
Set(HomeTimerStartTime,Now());
Set(UTCNow,Today());
Set(UTCNext,DateAdd(UTCNow,2,Days));

 It changes to

Set(MyUserId;Office365Users.MyProfile().Id);
Set(HomeTimerStartTime;Now());
Set(UTCNow;Today());
Set(UTCNext;DateAdd(UTCNow,2;Days));

which also doesn't "compile" due to missing semicolons at the end of the line (we need two in Germany). When I add the missing semicolons, the same automatic change as in the first two parts happens.

1 ACCEPTED SOLUTION

Accepted Solutions

So, after a bit more digging into the code I found the error (or let's say the part that causes it).

It's the ForAll() function (which I was using in my formula, but didn't provide in the sample codes above, shame on me.

 

If I rework the code to omit using ForAll, everything is working again as expected.

 

What's still broken is converting older apps to newer app structures. If you look into the file structure of an older exported *.msapp there are some differences to newer app versions. The automatic conversion which happens if you start editing an older app messes up some code by reverting code with double semicolons as "line ends" to single semicolons and changing semicolons to commas as parameter dividers.

View solution in original post

4 REPLIES 4
CarlosFigueira
Power Apps
Power Apps

I tried the same scenario, even a (very similar) expression, and couldn't reproduce your issue:

Set(MyUserId;'Office365-Benutzer'.MyProfile().Id);;
Set(HomeTimerStartTime;Now());;
Set(UTCNow;Today());;
Set(UTCNext;DateAdd(UTCNow;2;Days));;

I was able to save an app with this expression on the OnStart. If you create a new app and have a similar expression, do you see the same issue, or does it happen with a specific app only?

One thing you can try - removing the last ';;' from the expression, since there are no other statements after the line that sets the UTCNext variable. Can you let us know if this makes a difference?

Anonymous
Not applicable

Hi @AlexN,

 

It seems you've discovered the same kind of error I have. Only with the difference that it doesn't concern OnStart() in my case but a normal button.

I am at least glad that I am not an individual case and hope that the bug will be fixed soon.

 

Here is my topic: https://powerusers.microsoft.com/t5/General-Discussion/Faulty-saving-process/m-p/271554#M79365

AlexN
Advocate V
Advocate V

Have the same problem with another app now. What both have in common: They are older apps that didn't have the separate OnStart() trigger nor the "App" part before. Both had the OnStart() trigger on the first form.

 

When I start editing, the App "part" with the separate OnStart gets created, but completly messed up. Afterwards there is no way to repair, it always ends up messed up after loading the editor.

 

Exporting the app as zip though shows, that the code is correct after export. So this must be some import problem.

So, after a bit more digging into the code I found the error (or let's say the part that causes it).

It's the ForAll() function (which I was using in my formula, but didn't provide in the sample codes above, shame on me.

 

If I rework the code to omit using ForAll, everything is working again as expected.

 

What's still broken is converting older apps to newer app structures. If you look into the file structure of an older exported *.msapp there are some differences to newer app versions. The automatic conversion which happens if you start editing an older app messes up some code by reverting code with double semicolons as "line ends" to single semicolons and changing semicolons to commas as parameter dividers.

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.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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 (4,494)