Power Apps: Automatically edit the first item in a Gallery

Recently, I created a Power App for tasks assigned to users. The users logs in at the start of the day and has a series of tasks assigned for that day. The user needs to completed the task in order of the timings specified. When they click start task, they need to be taken to the edit screen for the first task in the gallery.

To pull the first item from the gallery into the edit form, change the form property called Item to:

First(Gallery1.AllItems)

Setting up the app this way creates a dependency between the Start Screen and the Edit Screen. When the first screen depends has data that is passed to other screens, this affects the Power App’s performance. The Power App loads the first screen and all screens that has dependencies when the Power App initiates. To avoid this, create variables and collections to store data that is passed between screens.

If you want to remove the dependency from the 2 screens so that both screens don’t have to load when the screen loads. Pass the value of the item as a parameter to the next screen. This allows the filtering of the Gallery to happen on the start screen where the gallery lives.

The OnSelect property for the Start Task button would look like this:

Navigate(‘Edit Task Screen’, ScreenTransition.Cover, {currentItem: First(Gallery1.AllItems)})

Then set the form item property to currentItem.