cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sajarac
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

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.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
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

15 REPLIES 15
Eelman
Super User
Super User

@sajarac 

In the OnSuccess property of your form add this code

 

Set(VarRecord, yourFormName.LastSubmit)

 

Change 'yourFormName' to the name of your form.

 

 

 

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

@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.

@sajarac 

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

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 

@sajarac 

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

@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).

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

v-xida-msft
Community Support
Community Support

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

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