cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Form Edit not poppulating correctly

Hi, I'm very new to PowerApps and have taken a head on approach to creating an app for my company, so my decisions may not be optimal to the process of a seasoned PowerApps creator.  The application communicates via an implicitly shared connection to an SQL server hosted by Azure. As far as form editing goes, I have set up screens for each type of entry type necessary, since functionality varies for each. The edit screen is reached via a button on each gallery field. Navigation ButtonNavigation Button

This button starts a timer that OnTimerEnd() will Navigate to the edit form. Prior to the timer's implementation, the Navigation was solely conducted via the button pointed out in the image above. The timer was implemented because when an item was selected via the gallery; You were taken to the earliest created item in that gallery. This only happened when you were moving from ticket to ticket very rapidly, thus the implementation of the timer delay. But now I have run into the problem of occasionally having that same issue occur(very rare), and the very reliable issue of the first ticket you try to navigate to always returning an edit screen with blank values.

I must also say that I am not using the included form objects (edit form display form), but am assigning various label's defaults to the gallery's selected item value for that field. powerappsEditPic.png

 

Initially, I believed that I was refreshing the connection to SQL Server too often; however, I am starting to think that it is an issue with how I am displaying the data. Any ideas on how to resolve the issue I am seeing when I load the edit screen for the first time, or why the first item keeps being displayed if navigating between items too quickly are both welcome.

3 REPLIES 3
RandyHayes
Super User
Super User

@Anonymous 

You are relying on the Selected property of the Gallery.  PowerApps gets data as needed.  So, your Gallery might list certain parts, but when you navigate to the edit screen, then it "demands" the record and must get it.

 

First, get rid of the timer - you don't need it.

Get rid of your Refreshes - they will slow your app down.

Next, instead of relying on the Selected property of the Gallery, change your OnSelect for the Icon to:

   Set(glbCurrentRecord, LookUp(yourDataSource, ID=ThisItem.ID)); Navigate(yourEditScreen)

Replace the ID part with whatever is the primary key column from your SQL datasource.

When you Set a variable like that, PowerApps will wait until the full record is retrieved.

Finally, set the Item property of your Form to : glbCurrentRecord

 

I hope this is helpful for you.

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

I knew that the refreshes would slow down the app, and I think that is definitely a source, but it was requested that multiple users will be using the app and if 2 users are on the same ticket they would want to see live changes done. This was only achievable via refreshes. Is there any alternative to reaching this level of functionality?

RandyHayes
Super User
Super User

@Anonymous 

Yes - realize that PowerApps is not real time!!  There are certain tricks that can be done to avoid the refreshes and still get changes, but they are not really real-time either.

Best thing to do is to work out another way to augment the data for the ticket with another list, or avoid having 2 users edit at the same time.  If that is a hard and firm requirement, then PowerApps may not be the best choice.  Yes, it can be "wedged" into simulating it, but it comes at the cost of performance and occasional data errors and lost data - which become more of an issue than the first.

 

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,166)