Showing results for 
Search instead for 
Did you mean: 
Resolver II
Resolver II

Executing from Edit works but executing directly does not

I have run into this before with this app, many versions ago, but it's back and I have no idea what causes it or how to resolve.  Simpy put, buttons to naviate don't do anything but respond visually that they have been selected, and a custom data entry screen displays in a completely weird form.  Not all buttons don't work but some do not.  This happens in a browser (I used three different ones, standard and private mode) as well as a mobile device.


However, it I start running the app from within edit mode, everything works just fine.  By that I mean that I start editing, and immediately as soon as it can, I play the app.


I do believe that when this happened before, I had logic in the app to deal with devices using it that may be offline or go offline or come back online during execution.  The app start checks to see if online or offline and goes to seperate screens based on that.  The online screen has onvisible code to check from loaddata if any submitted data was stored, and if so, patch it to a SP list, but otherwise just clearcollect some data for exceuton and go to a home screen. 


On the home screen i have images whose onselect functions are to navigate to other screens.  all they do is Navigate(screen, none).  For testing purposes, I added some additional buttons.  One of the images works when I go click on it, the buttons and other images do not.  I can tell the butttons are responding to clicks as i had them change color.  One of the screens I can navigate to has a neat and orderly layout for some data entry and camera capture, but when I am get there the display is completely jumbled: fields out of order, on top of one another, and so on.


To be clear this happens when I execute directly with a browser or a device but not if I play the app from within edit mode.  I do know that LoadData() and SaveDate() don't work in a browser but I have, for the most part, logic to not deal with them except if a device is offline, or comes back online.  Yes, at startup I do a LoadData() to see if any had been saved from a previous offline situation, but it should operate ok on a phone???


I am completely stumped by this behavior.  How can it work from edit/play but not from direct execution?  How can a naviagate not work as the onselect for a button as the only command?


I have struggled mightily with loaddata/savedata. for weeks it didn't work, then all of a sudden it starting working, same app.  go figure.





Resolver II
Resolver II

I isolated the problem to onvisible code:  if I comment out from LoadData and Patch, the app has no problems.  But I need to have the functionality in the app!  In plain language, what this does is:  LoadData() retrieves any previously instances of data being submitted while the app was not connected.  If there was any - CountRows woud not be 0 - then the saved data is added to a SP list.  And this screen is reached only if connection is detected.


What made me focus on this is that a message is displayed based on the variable varOktoStart while a button to continue is displayed when that variable is true, the last statement in the onvisible code.  It seems to never get executed.  Same behavior whether it is on a mobile device or desktop browser.  


Set(varOKtoStart,false);  // hide continue button  This display message but hides buttom
LoadData(colTags,"Tags",true);  Loads previously saved data if any
If(CountRows(colTags)>0,  // yes there are saved tags so Patch() them now  determines if there was any 
  ForAll(colTags,  // patch for each saved tag submitted  Patches each element of saved data
           {Title:Text(Today(),"[$-en-US]mm/dd/yyyy")&" "&varUserName&" "&varUserEmail,
// Now get what is needed for connected app to run  
ClearCollect(colUser,{UName:varUserName,UEmail:varUserEmail});  Creates collections that are then saved to device
SaveData(colTags,"Tags"); // save empty tag collection
SaveData(colIN,"Inches");  // save Inches table
SaveData(colTable1,"Table1"); // save CM table
SaveData(colUser,"User");  // save user information
Set(varOKtoStart,true)  // allows user to continue by display button  This does not seem to execute
It seems that even on a mobile device the SaveData() commands fail to execute and cause it to quit.  No errors appear on the editing page, no errors when it runs on desktop browser or on mobile device, still it fails.  When I play it from edit mode, it seems to work just fine.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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