Reset () function failing to work on Edit form for Combo boxes in Power App.
Hi Good day,
Today we have a very interesting scenario. We have a cascading dropdowns on our Power App screen.
The flow for these dropdowns is that a user selects the Division, and a list of Business units containing the selected Division is popped down in your Business Unit dropdown.
Now to make it user friendly, we have on change code written on each dropdown. So that if the user decides to change the Division dropdown, the Business Unit dropdown is reset.
Please remember in here we are talking in regarding to New Form.
On Resetting the above Division combo box, since we have written the Reset function code on Change property of the Division Combo box.
The above becomes
Up till here everything is hunky dory. This is the classic case of how the Reset() function should behave.
But that's not, when you move from new form to Edit form.
The Reset function behaves weirdly. It is able to reset the cascading dropdown values like above. But it will still show the default value for this dropdown.
Now we cannot set the default selected items property to "", as we are using this to retrieve the values in the edit form. And the Reset function is working correct as in New form its not only firing, but also doing what is intended from it.
To fix this bug we need to follow 3 steps.
Step 1. Lets first Create a variable
Set(varResetddBU, Blank());
Set the above variable - OnVisible Property of the first screen of your app. Please note its the screen and not the form.
Step 2. Set the onChange property of the Division combobox control
Set(varResetddBU, Blank());
Set(varResetddBU,true);
Step 3. Set the DefaultSelectedItems Property of the Business Unit combo box. to below.
if(!IsBlank(varResetddBU),{},Parent.default)
Now if you test the same, you will see Reset() function working perfectly in Edit form as well.
The above fix works perfectly with multi level cascading columns as well.
Comments
Post a Comment