cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nikhil2
Helper V
Helper V

Form Reset to First selection of Gallery

I have created Gallery1 on Screen1 and on select of Gallery 1 . Gallery 1 pulls the data from Dataverse. And On select it navigates to status screen when i make changes on silder and submit as form it resets to blank or reset to First item of the gallery

 

Gallery1 functions.

Default: LookUp(data source,'Project Name'=var)

OnSelect: Set(var,ProjectList.Selected.'Project Name')

Items: Sort(If(TabMenu = "All", Search(data source, SearchFieldProjects.Text,"cra32_projectname", "cra32_department"),
TabMenu = "Completed",
Filter(Search(data source, SearchFieldProjects.Text, "cra32_projectname", "cra32_department"), 'Project Status'="Not On Track")), "cra32_projectname", Ascending)

 

Screen2 

Silder DataCard: 

Datafield: "cra32_scopefullfillment1"

Displayname: DataSourceInfo([@data source],DataSourceInfo.DisplayName,"cra32_scopefullfillment1")

Default: ThisItem.'Scope Fullfillment1'

MaxLength: DataSourceInfo([@data source], DataSourceInfo.MaxLength,"cra32_scopefullfillment1")

Nikhil2_1-1658331798128.png

 

When OnChange of the silder "Submitform" but it resets complete info to first item of gallery1. Like Project Name and other data.

 

How to hold the record of the selected data from the gallery in the screen 2 without changing or resetting to First item of Gallery 1

 

Soon form submission this is what happens

 

Nikhil2_0-1658333148476.png

 

 

25 REPLIES 25
RandyHayes
Super User
Super User

@Nikhil2 

What is the Item property of your Form and what is the OnChange action of your Slider?

_____________________________________________________________________________________
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!

Item property of Form, ProjectList is Gallery 1

 

ProjectList.Selected

 

 OnChange of Slider

 

SubmitForm(Form2_2)

 

RandyHayes
Super User
Super User

@Nikhil2 

Your OnChange action is going to cause a lot of data submit traffic, which could be detrimental in performance to your app.

But, that aside, Change your OnSelect action on the Gallery to:

Set(glbCurrentRecord, ThisItem);

Set(var,ProjectList.Selected.'Project Name');

 

Then set the Item property of the Form to:

glbCurrentRecord

This will keep the submitting of the form to the currently selected record from the gallery.

 

However, Your Gallery itself will always reset to the first record because you are updating the underlying datasource of the Gallery Items and you have a complex formula (considered so because of the Search and Sort function in it) and the app will reevaluate that formula after the underlying data is changed.

 

To attempt to keep the gallery on the selected record, you can change the Default property of the gallery to: glbCurrentRecord

_____________________________________________________________________________________
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!

I cannot see the slider, I have Changed the Onselect and Item of both

Nikhil2_0-1658333710351.png

 

RandyHayes
Super User
Super User

@Nikhil2 

That message indicates that the record is not getting set.  Check your variable glbCurrentRecord and make sure you have the syntax correct and that it has a record in it.

_____________________________________________________________________________________
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!

Gallery1

Nikhil2_0-1658348575260.png

Nikhil2_1-1658348592793.png

Item Property of Form

Nikhil2_3-1658348695121.png

But i am not sure how come it cannot find any data in the variable as there is data stored as 50

RandyHayes
Super User
Super User

@Nikhil2 

Okay, so that variable should be getting set whenever you click on a gallery item.

 

What is the Items property of the gallery and is it based on the same datasource as the 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.
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!

Gallery item : Screen 1

 

 

Sort(If(TabMenu = "All", Search(Project, SearchFieldProjects.Text,"cra32_projectname", "cra32_department"),
TabMenu = "Completed",
Filter(Search(Project, SearchFieldProjects.Text, "cra32_projectname", "cra32_department"), 'Project Status'="Not On Track")), "cra32_projectname", Ascending)

 

 

Form, Datasource : Screen 2

 

 

Project

 

 

RandyHayes
Super User
Super User

@Nikhil2 

Then your glbCurrentRecord should contain a valid record that is selected from your Gallery.  Need to determine why you are not getting a valid record when you select one in your Gallery.  Is the Gallery in Edit mode?

_____________________________________________________________________________________
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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,552)