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

Set(VarRecord, This Item) to Replace BrowseGallery1

Hi community.

 

I was checking a video from Shane Young

 

And he mentioned that is better to start replacing the onselect = Navigate......... 

by:

Set(varRecord, ThisItem);Navigate......

then in the target form items = VarRecord

 

Basically replacing Gallery1.selected.

 

He said that this method is better and secure.

 

Now my question is?

I did that and my target form is a form. After press to EDIT the form and save the changes the updates didn't come up. I have to go back select the item again and after that I can see the changes.

 

How can I fix this? I have tried Refresh etc but nothing works.

 

Thanks in advance,

 

Regards,

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

Hi @sajarac ,

 

BrowseGallery1.selected will give you the selected record of the gallery however it will create the dependency of the previous screen when you move out of the screen so it is always a good idea to set the selected record to a variable and use that varaiable the following screen.

 

Again, there is nothing wrong but it will pull down the performance of the APP.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

 

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

14 REPLIES 14
Highlighted
Super User II
Super User II

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

@sajarac 

In the OnSuccess property of your form add this code

 

Set(VarRecord, yourFormName.LastSubmit)

 

Change 'yourFormName' to the name of your form.

 

 

 

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

Hi there, any other possible solution? my form is acting weird after I have implemented this option ?

Highlighted
Super User III
Super User III

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

@sajarac
In the Item property of the edit form: Lookup(datasource, ID=VarRecord.ID) and make sure the datasource in the Form is the same one as referenced in the Item property.

Highlighted
Super User II
Super User II

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

@sajarac 

Define '...acting weird ...'. I use this throughout my apps without any issues

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

Thank you.

@Drrickryp @Eelman 

I did the Lookup addendum, it seems like is working a little bit better just one thing is not working fine. In the form I have 3 Dropdowns they work in a cascade way. I noticed that those 3 are keeping the last information saved. But if I put the form in edit mode and cancel or save the it show the right value.

 

Any idea?

 

Thank you 

Highlighted
Super User II
Super User II

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

@sajarac 

Sounds like the issue will be to do with the Default properties of those dropdowns.

Highlighted
Super User III
Super User III

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

@sajarac 

 In the OnSuccess property of the form, put ResetForm(Form1).  When the form is submitted successfuly, all of the controls on it will be reset to their default properties.  As a alternative, you can reset each control individually using Reset(Dropdown1); Reset(Combobox1); Reset(Combobox2).

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

I did a Refresh in between changes and it shows the right information.

Highlighted
Community Support
Community Support

Re: Set(VarRecord, This Item) to Replace BrowseGallery1

Hi @sajarac ,

Have you solved your problem?

 

Based on the issue that you mentioned, I think this issue is related to the varRecord variable. If you update the selected record using your Edit form, you should also update the varRecord variable to the updated record simultaneously, otherwise, this varRecord variable would still store previous record.

 

So please consider set the OnSuccess property of the Edit form to following:

Set(varRecord, EditForm1.LastSubmit)  // update the varRecord variable to the updated record

Set the Item property of the EditForm1 to following:

varRecord

 

Actually, it is not necessary to store the whole selected record into a variable, instead, you could consider save the PrimaryKey column value of the selected record into a variable. Please also consider try the following workaround:

Set the OnSelect property of the Gallery to following:

Set(varPrimaryKey, ThisItem.PrimaryKeyColumn)

Set the Item property of the Edit form to following:

LookUp('Your Data Source', PrimaryKeyColumn = varPrimaryKey)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,015)