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

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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 271 members 5,214 guests
Please welcome our newest community members: