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

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
Community Support

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
Community Support

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

Anonymous
Not applicable

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

 

Thank you,

 

@Anonymous 

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,781)