cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

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.

 

HELP!

@Mr-Dang-MSFT

 

1 REPLY 1

Re: Executing from Edit works but executing directly does not

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
         Patch(TagSubmissionsSP,Defaults(TagSubmissionsSP),
           {Title:Text(Today(),"[$-en-US]mm/dd/yyyy")&" "&varUserName&" "&varUserEmail,
            TagNumber:txtTagNumber,
            RecoveryDate:dteRecoveryDate.SelectedDate,
            Depth:txtDepth.Text,
            LandingPort:txtLandingPort.Text,
            VesselName:txtVesselName.Text,
            VesselNumber:txtVesselNumb.Text,
            Length:txtLength.Text,
            FirstName:txtFname.Text,
            LastName:txtLname.Text,
            MI:txtMI.Text,
            Address:txtAddress.Text,
            City:txtCity.Text,
            State:txtState.Text,
            Zip:txtZip.Text,
            TagType:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Id:1,Value:drpTagType.Selected.Value},
            Sex:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Id:1,Value:drpSex.Selected.Value},
            GearType:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Id:1,Value:drpGearType.Selected.Value},
            RewardType:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Id:1,Value:drpRewardType.Selected.Value},
            LenghtMeasure:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Id:1,Value:drpInCM.Selected.Value},
            TagImage:galPhoto.Selected.lblURLPhoto.Text}
        )
));
// Now get what is needed for connected app to run  
Set(varUserName,Office365Users.MyProfile().DisplayName);
Set(varUserEmail,Office365Users.MyProfile().Mail);
ClearCollect(colUser,{UName:varUserName,UEmail:varUserEmail});  Creates collections that are then saved to device
ClearCollect(colIN,lw_inchesSP);
ClearCollect(colTable1,lw_centimetersSP);
ClearCollect(colTags,TagSubmissionsSP);
Clear(colTags);
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

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 301 members 3,211 guests
Please welcome our newest community members: