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

Keep dropdown value when navigating back and forth

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

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

View solution in original post

1 REPLY 1
v-siky-msft
Community Support
Community Support

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

View solution in original post

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

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

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (60,050)