cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tonykiefer
Advocate II
Advocate II

View form data and data table disappear after data loads

@RandyHayes ...can you review this?

 

I have a view form that renders data but after the data is loaded it takes about 50 seconds and the data disappears.

 

I also have an activity log that is dependent on the view form data.  I can stop the app and reload the test data to access the activity log.  When activity log data loads in the data table it also disappears after about 50 seconds.

 

All data loads and it matches the db values.  Below are two Screencasts to demonstrate.

https://www.screencast.com/t/ZF4w4fdzuxO

https://www.screencast.com/t/cCbby7r2r

 

Powerapps doesn't report any errors on this.

 

Any ideas as to way the data disappears?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@tonykiefer 

Yes, you can most certainly have your form be View, Edit and New all in one.  That is preferred, but you need not use a variable to do it - ViewForm(yourForm) will put it in View mode.  NewForm(yourForm) will put it in New mode.  ViewForm(yourForm) will put it in View mode.  That video shows a rather "clunky" way to go about just doing it directly and complicating your app.

 

I'm a little off on which icon is which.  I see you have the right chevron for the View, you have an Edit Icon in the Gallery...presumably to edit that record, and then you have a ActivityLog icon.

 

So, your Edit Icon OnSelect action should be:

   Set(currentRecord, ThisItem); EditForm(yourForm); Reset(TextSearchBox1); Navigate(EditForm1, Fade)

I assume that EditForm1 is the name of your screen and not the name of your form...It should be the screen name.

 

For the Right Chevron OnSelect Action:

   Set(currentRecord, ThisItem); ViewForm(yourForm); Reset(TextSearchBox1); Navigate(EditForm1, Fade)

 

The Item property of your EditForm should be: currentRecord

The OnSuccess action of your EditForm should include : Set(currentRecord, Self.LastSubmit)

 

Now for the Activity log.  (the OnSelect action formula you have for the Icon is fine)

The Items property should be : Filter(ItemTracker_Transactions, ItemID = currentRecord.ItemID)

 

One final bit...you should set the DisplayMode of your Activity Log to the following:

   If(yourForm.Mode = FormMode.New, Disabled, Edit)

This way users are not going to be able to click on the activity log of a record that does not yet exist.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

5 REPLIES 5
RandyHayes
Super User III
Super User III

@tonykiefer 

Your data is having issues loading!!  

Tell me more about:

- the datasource you are using

- the Item property of your Form

- the OnSelect action of your form

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi @RandyHayes ,

The data source is SQL Server

2.jpg

Here are the details of the project forms.

The home page...the entire record set will load.  There are 897 records.

The Edit Icon onSelect is set to...

Set(varMode, "Edit Badge: "); Reset(TextSearchBox1); Navigate(EditForm1, ScreenTransition.Fade)

 

Note: I know you say to avoid using variables but I saw this helpful video on how to use one form for Edit, View, and New records (CRUD).  This is why the varMode is set to "Edit Badge: " when the edit icon is select.  Moving forward is this a bad idea?

 

The same for the Right Chevron (View Icon) onSelect property.

Set(varMode, "View Badge: "); Set(RefId, ThisItem.Ref_ID); Reset(TextSearchBox1); Navigate(EditForm1, ScreenTransition.Fade)

 

1.jpg

The EditForm1 Item Property is set to BrowserGallery1.Selected.

 

This onSelect property for the Activity Log is set to Navigate(ActivityLog, ScreenTransition.Fade).

And the Items property of the activity log DataTable1 is set to... Filter(ItemTracker_Transactions,ItemID=BrowseGallery1.Selected.ItemID).

3.jpg

One interesting note is...the data is only disappearing for new records or modified records.  I am not using any triggers or stored procedures.

 

I hope this information helps.

 

RandyHayes
Super User III
Super User III

@tonykiefer 

Yes, you can most certainly have your form be View, Edit and New all in one.  That is preferred, but you need not use a variable to do it - ViewForm(yourForm) will put it in View mode.  NewForm(yourForm) will put it in New mode.  ViewForm(yourForm) will put it in View mode.  That video shows a rather "clunky" way to go about just doing it directly and complicating your app.

 

I'm a little off on which icon is which.  I see you have the right chevron for the View, you have an Edit Icon in the Gallery...presumably to edit that record, and then you have a ActivityLog icon.

 

So, your Edit Icon OnSelect action should be:

   Set(currentRecord, ThisItem); EditForm(yourForm); Reset(TextSearchBox1); Navigate(EditForm1, Fade)

I assume that EditForm1 is the name of your screen and not the name of your form...It should be the screen name.

 

For the Right Chevron OnSelect Action:

   Set(currentRecord, ThisItem); ViewForm(yourForm); Reset(TextSearchBox1); Navigate(EditForm1, Fade)

 

The Item property of your EditForm should be: currentRecord

The OnSuccess action of your EditForm should include : Set(currentRecord, Self.LastSubmit)

 

Now for the Activity log.  (the OnSelect action formula you have for the Icon is fine)

The Items property should be : Filter(ItemTracker_Transactions, ItemID = currentRecord.ItemID)

 

One final bit...you should set the DisplayMode of your Activity Log to the following:

   If(yourForm.Mode = FormMode.New, Disabled, Edit)

This way users are not going to be able to click on the activity log of a record that does not yet exist.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Hi @RandyHayes,

 

Thank you for the help...again!  So let me see if I have this straight.  Starting from the BrowserGallery1...While navigating to the View and Edit pages it is not enough to simply reference the BrowserGallery1.selectedItem.  Rather it is more of a complete CRUD operation to Set(currentRecord, ThisItem) from the gallery then reference the current record in the Items property of the target page by "currentRecord".  Before I was not setting the current record by id.  I was merely referencing the BrowserGallery1.selectedItem from the target page.  I'm curious why my approach was causing a loading issue?

 

As far as "Set(currentRecord, Self.LastSubmit)"...this basically means we are preparing to save the currentRecord. "Self" will allow me to access all the properties of the "currentRecord" and LastSubmit will show the currentRecord when the action of the submitting the record is a success.

 

Previously, I had the displayMode of the activity log set to "Edit".  I can see the value of "If(yourForm.Mode = FormMode.New, Disabled, Edit)".  This is an elegant way user control and preventing exceptions.

 

I know I ask lot of questions and in return I feel it necessary to show I understand.  Again you've been a great help and through our thread I am continuing to learn a ton!

 

Also...the loading issue has been resolved.  Thanks Again @RandyHayes!

RandyHayes
Super User III
Super User III

@tonykiefer 

So kind of!  

Let me re-write what you said with some alterations.

 

Thank you for the help...again!  So let me see if I have this straight.  Starting from the BrowserGallery1...While navigating to the View and Edit pages it is not enough to simply reference the BrowserGallery1.selectedItem.  Rather it is more of a complete CRUD operation to Set(currentRecord, ThisItem) from the gallery then reference the current record in the Items property of the target page by "currentRecord".  Before I was not setting the current record by id.  I was merely referencing the BrowserGallery1.selectedItem from the target page.  I'm curious why my approach was causing a loading issue?  Your approach is actually very typical and can be used.  However there are some caveats to just referencing the SelectedItem from the Gallery in the Form.  However, usually, when I am responding to posts here I lean toward the variable method because I am not always sure of the source on the Gallery and how it is used in the app.  So, this is more of a "pretty much will always work" method.

 

As far as "Set(currentRecord, Self.LastSubmit)"...this basically means we are preparing to save the currentRecord. "Self" will allow me to access all the properties of the "currentRecord" and LastSubmit will show the currentRecord when the action of the submitting the record is a success.

Actually, not so much preparing - we have already saved.  That formula goes in the OnSuccess action of the form.  So this means that the form has saved and was successfully completed.  The reason we reset the currentRecord variable is, again, because I am not familiar with the flow of your app.  Sometimes after OnSuccess the app designer will issue a Back() function or Navigate to go to some other screen.  Sometimes they just remain on the form screen.  So, if you remain on the form screen, then the form is going to show what is in currentRecord.  You will remember, that is a variable and is a snapshot of when it is set.  The last time it was set was from the Gallery...so, it will have old values in it.  If we set it again in the OnSuccess, then the variable will now have a snapshot of the record that was last submitted.

Self references the form.  The Form has a LastSubmit property on it.  The LastSubmit property contains the full record that was last submitted (including new values as in the case of a primary key/ID).

So...we are setting the currentRecord to the record that is in the LastSubmit property of the form (self).

 

Previously, I had the displayMode of the activity log set to "Edit".  I can see the value of "If(yourForm.Mode = FormMode.New, Disabled, Edit)".  This is an elegant way user control and preventing exceptions.

Yes, app design is always about being user friendly!

 

I know I ask lot of questions and in return I feel it necessary to show I understand.  Again you've been a great help and through our thread I am continuing to learn a ton!

Asking questions is the way to learn, so don't be hesitant to ask!

 

And finally...I am glad to hear the initial issue is resolved!!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (11,556)