cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JHChoi81
Helper I
Helper I

How to keep selected gallery item after updating?

Questiong.png

When I update item, selected gallery item is changed, but i want to keep this.
Could you let me know why it happened and what is the solution ? 

 

Thank JH

2 ACCEPTED SOLUTIONS

Accepted Solutions
eka24
Super User III
Super User III

On the OnVisible of the screen, Create a variable;

Set(MySelected, GalleryName.Selected)

 

You can use the variable: MySelected anywhere in your App.

Edited:

You can set the Default of the Gallery to:

MySelected

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Hi @JHChoi81 ,

Based on the screenshot that you mentioned, I found that your second Gallery (Gallery1) has been bind to the selected item in your First Gallery (FixtureListMain_2), right?

 

According to the issue that you mentioned, I think this issue is related to your UpdateIf function. When you execute your UpdateIf function successfully, your FixtureMasterList data source would be refreshed, then your First Gallery FixtureListMain_2 would also be reset. So the FixtureListMain_2.Selected formula would be reset to the first record in your FixtureListMain_2 Gallery.

 

As an fixed solution, please take a try with the following workaround:

Set the OnSelect property of the FixtureListMain_2 Gallery to following:

Set(CurrentSelectedItem, FixtureListMain_2.Selected)

 

Set the Items property of the Gallery1 (second Gallery) to following:

Filter(FixtureMasterList, ID = CurrentSelectedItem.ID)

remove the formula from the Default property of the Gallery1.

 

Please consider take a try with above solution, 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.

View solution in original post

8 REPLIES 8
eka24
Super User III
Super User III

On the OnVisible of the screen, Create a variable;

Set(MySelected, GalleryName.Selected)

 

You can use the variable: MySelected anywhere in your App.

Edited:

You can set the Default of the Gallery to:

MySelected

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

It has same problem. 

1. Gallery1 -> Items : 

SortByColumns(

If(TextInput1_3.Text="" && TextInput1.Text="",

                 Filter(FixtureMasterList,Applied = ddFixtureType_3.Selected.Result && FixtureName=Dropdown1_1.Selected.Result),
If(TextInput1_3.Text="",
                 Search(FixtureMasterList,TextInput1.Text,"FixtureName"),
                 Search(FixtureMasterList,TextInput1_3.Text, "FixtureNum"))),
                                                                                                            "FixtureNum",Ascending)

what is wrong ? 

 

JH

The procedure I stated is the way to go. However remember you have about 3 criteria using If function. So if the variable does not Fall into the criteria, it may not work. 

Can you give a screenshot of the formula I gave

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Untitled1.pngUntitled2.png

I don't know what is wrong.... 

I cant see the Variable in the Default of the Gallery, you have rather put the FixedMasterList there.

The suggestion was to create a variable onvisible and put the variable on the default.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Sorry,

I've followed your recommend.

But, it also has same problem. 

 

OnVisible : Set(MySelected,FixtureListMain_2.Selected)

Untitled3.pngUntitled4.png

Hi @JHChoi81 ,

Based on the screenshot that you mentioned, I found that your second Gallery (Gallery1) has been bind to the selected item in your First Gallery (FixtureListMain_2), right?

 

According to the issue that you mentioned, I think this issue is related to your UpdateIf function. When you execute your UpdateIf function successfully, your FixtureMasterList data source would be refreshed, then your First Gallery FixtureListMain_2 would also be reset. So the FixtureListMain_2.Selected formula would be reset to the first record in your FixtureListMain_2 Gallery.

 

As an fixed solution, please take a try with the following workaround:

Set the OnSelect property of the FixtureListMain_2 Gallery to following:

Set(CurrentSelectedItem, FixtureListMain_2.Selected)

 

Set the Items property of the Gallery1 (second Gallery) to following:

Filter(FixtureMasterList, ID = CurrentSelectedItem.ID)

remove the formula from the Default property of the Gallery1.

 

Please consider take a try with above solution, 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.

View solution in original post

pwagma
Helper I
Helper I

This is an interesting solution, but the problem for me it comes when I modify the data. The source gets updated but not the variable, what I am missing?

Thanks

Pablo

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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (19,211)