cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
hnguy71
Level 8

Reset Dropdown list based on another dropdown list

Good afternoon, All.

Happy Easter!

 

I have form that has a cascading dropdown list based on a previous dropdown's selection.  The cascading dropdown is a relationship between Bank and Accounts. What's currently not working is when I switch over to another Bank, the previously selected Account dropdown list value does not reset.  Here's what I have currently:

 

On Screen Visible: Set(ResetMe, false)

screen4.PNG

 

On Bank Name Change Property: ClearCollect(_Accounts, {Accounts: Blank()}, Filter(BankDatabase, Bank = DataCardValue25.Selected.Value));UpdateContext({ResetMe: true})

screen2.PNG

 

On Account Reset Property: ResetMe

screen3.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Reset Dropdown list based on another dropdown list

Hi @hnguy71 ,

Do you want to reset the previously selected Account option within the Account Dropdown box?

Could you please show more details about the formula you typed within the Items property of the Account Dropdown box?

 

Firstly, based on the formula that you mentioned, I think there is something wrong with it. The Set() function is used to create a global variable, but the UpdateContext() function is used to create a context variable.

The ResetMe variable you initizlied within the OnVisible property of the screen is a global variable, but the UpdateContext() function within the OnChange property of your Bank Dropdown box is used to create a context variable (initizlied with true value) rather than update the existing global variable.

On your side, please consider modify your formula within the OnChange property of the Bank Dropdown box as below:

ClearCollect(
_Accounts,
{Accounts: Blank()},
Filter(BankDatabase, Bank = DataCardValue25.Selected.Value)
);
Set(ResetMe, true) /* <-- Modify your formula here. Use Set() function to update the global variable */

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

 

Actually, it is not necessary to reset the Account Dropdown box via initizlizing a global variable. I have made a test on my side, please take a try with the following workaround:7.JPG

 

8.JPG

Set the OnStart property of the App control to following:

ClearCollect(
            BankDatabase,
            {Bank: ""},
            {Bank: "Nanjing Bank", Accounts: "Kris Dai"},
            {Bank: "Nanjing Bank", Accounts: "Teresa Wang"},
            {Bank: "NingBo Bank", Accounts: "Steven"},
            {Bank: "NingBo Bank", Accounts: "Ned"}
);

Set the OnChange property of the Bank Dropdown box (Dropdown1) to following:

ClearCollect(_Accounts, {Accounts: Blank()}, Filter(BankDatabase, Bank=Dropdown1.Selected.Value))

Set the Items property of the Accounts Dropdown box to following:

_Accounts

Please check the following GIF screenshot for more details:Test.gif

 

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

2 REPLIES 2
Community Support Team
Community Support Team

Re: Reset Dropdown list based on another dropdown list

Hi @hnguy71 ,

Do you want to reset the previously selected Account option within the Account Dropdown box?

Could you please show more details about the formula you typed within the Items property of the Account Dropdown box?

 

Firstly, based on the formula that you mentioned, I think there is something wrong with it. The Set() function is used to create a global variable, but the UpdateContext() function is used to create a context variable.

The ResetMe variable you initizlied within the OnVisible property of the screen is a global variable, but the UpdateContext() function within the OnChange property of your Bank Dropdown box is used to create a context variable (initizlied with true value) rather than update the existing global variable.

On your side, please consider modify your formula within the OnChange property of the Bank Dropdown box as below:

ClearCollect(
_Accounts,
{Accounts: Blank()},
Filter(BankDatabase, Bank = DataCardValue25.Selected.Value)
);
Set(ResetMe, true) /* <-- Modify your formula here. Use Set() function to update the global variable */

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

 

Actually, it is not necessary to reset the Account Dropdown box via initizlizing a global variable. I have made a test on my side, please take a try with the following workaround:7.JPG

 

8.JPG

Set the OnStart property of the App control to following:

ClearCollect(
            BankDatabase,
            {Bank: ""},
            {Bank: "Nanjing Bank", Accounts: "Kris Dai"},
            {Bank: "Nanjing Bank", Accounts: "Teresa Wang"},
            {Bank: "NingBo Bank", Accounts: "Steven"},
            {Bank: "NingBo Bank", Accounts: "Ned"}
);

Set the OnChange property of the Bank Dropdown box (Dropdown1) to following:

ClearCollect(_Accounts, {Accounts: Blank()}, Filter(BankDatabase, Bank=Dropdown1.Selected.Value))

Set the Items property of the Accounts Dropdown box to following:

_Accounts

Please check the following GIF screenshot for more details:Test.gif

 

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

TopShelf-MSFT
Level 10

Re: Reset Dropdown list based on another dropdown list

Thanks for posting in the community @hnguy71 - can you review the above reply and update the thread if it was helpful?

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (6,269)