web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Keep dropdown value wh...
Power Apps
Answered

Keep dropdown value when navigating back and forth

(0) ShareShare
ReportReport
Posted on by 252

Hello guys,

 

I have a dropdown menu connected to a custom collection that I use to filter my SP list.

When use it to filter, then select an item, I then navigate to its form.

 

When I click on my previous icon, to go back to my gallery, the value of my dropdown resets to default (which is a custom value called All).

 

How can I keep the value I set?

 

This is the code of my "OnVisible" property of my gallery screen:

 

ClearCollect(
 colDropdownOptions,
 {Result: "All"}
);
Collect(
 colDropdownOptions,
 Distinct(
 'Stock Management',
 Description
 )
);

 

This is the code of my "Item" property of my dropdown:

Sort(colDropdownOptions,Result,Ascending)

 

And this is the code of my gallery:

 

Sort(
 AddColumns(
 Filter(
 'Stock Management',
 Or(StartsWith(
 Model,
 TxtIn_AllProductsSearchBox.Text
 ), StartsWith(Title, TxtIn_AllProductsSearchBox.Text)) &&
 (
 Description = DpDwn_AllProducts.Selected.Result || 
 DpDwn_AllProducts.Selected.Result = "All"
 ) &&
 (
 Status = "High" || 
 Status = "Low" ||
 Status = "Average" ||
 Status = "Out"
 )
 ),
 "SortRank",
 (Stock/Threshold)
 ),
 SortRank,
 If(
 SortDescending1,
 Descending,
 Ascending
 )
)

 

This is the code of the previous button to go back to my gallery after selecting an item is just a back() function.

 

Thank you so much!

Anthony

 

 

Categories:
I have the same question (0)
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @AnthonyRegnier ,

     

    That is because the collection is re-generated again when navigate back to the screen.

    Please put the following to OnStart property of App, rather than Screen.OnVisible property.

    ClearCollect(
     colDropdownOptions,
     {Result: "All"}
    );
    Collect(
     colDropdownOptions,
     Distinct(
     'Stock Management',
     Description
     )
    );

     Hope this helps.

    Sik

  • atha_anto Profile Picture
    24 on at

    That helped me too. But what if i have two buttons? The first one is the "back" button and the second one "Home" button. the "back" button to go to the previous page keeping the option and the "home" button navigates back restoring to the default "all"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 893

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 482

Last 30 days Overall leaderboard