cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Siddz
Super User
Super User

Clear Multiple Selection ComboBox If DataCard Hidden

I would like to clear a multi-select combobox (from SharePoint) if the Visible property on its datacard is false. This formula works on the Reset() property for single-select dropdowns on FormMode.New:

 

// Reset Property
If(DataCardName.Visible = false, true, false)

 

However, for multi-select dropdowns on FormMode.Edit, the formula above only resets the control to the first choice value. I want the combobox to be blank if it's hidden.

 

Here's the scenario:

  • If a user selects "Choice A" from Dropdown A, DataCard-01 becomes visible (a single-select choice field)
  • If a user selects "Choice B" from Dropdown A, DataCard-02 becomes visible (a multi-select choice field)

I would like to clear these dropdown controls if they are hidden. As mentioned, Reset() works for all choice fields in FormMode.New, but it does work for multi-select choice controls in FormMode.Edit. 

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Siddz ,

Firstly, you can reset it by setting the Reset property of the control to a Variable (I will call it varReset here)

UpdateContext({varReset:false});
UpdateContext({varReset:true})

but this will then revert to whatever the DefaultSelectedItems are - so you can do this (assuming .Value as the output) - replace second part with current value - also change Value if applicable

If(
   varReset,
   {Value:Blank()},
   {Value:WhateverItIsNow}
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

@Siddz ,

The Reset Property of the control is simply varReset - you need to run the other code when you want it to reset - probably on the OnChange of A_Different_DataCard where the value chosen requires the reset.

If(
   Self.Selected.Value = "Choice A",
   UpdateContext({varReset:false});
   UpdateContext({varReset:true})
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @Siddz ,

Firstly, you can reset it by setting the Reset property of the control to a Variable (I will call it varReset here)

UpdateContext({varReset:false});
UpdateContext({varReset:true})

but this will then revert to whatever the DefaultSelectedItems are - so you can do this (assuming .Value as the output) - replace second part with current value - also change Value if applicable

If(
   varReset,
   {Value:Blank()},
   {Value:WhateverItIsNow}
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Siddz
Super User
Super User

Thanks, @WarrenBelz.

 

I'm getting a formula error when setting the Reset property of the control to:

UpdateContext({varReset:false}); UpdateContext({varReset:true})

 

Siddz_0-1640905541555.png

 

Currently, the DefaultSelectedItems property on the control is Parent.Default

 

The Visible property on the control's datacard is:

If(A_Different_DataCard.Selected.Value = "Choice A", true, false)

Is there a way to use Blank() on the datacard's Visible property? Maybe hide the datacard and clear it at the same time?

@Siddz ,

The Reset Property of the control is simply varReset - you need to run the other code when you want it to reset - probably on the OnChange of A_Different_DataCard where the value chosen requires the reset.

If(
   Self.Selected.Value = "Choice A",
   UpdateContext({varReset:false});
   UpdateContext({varReset:true})
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Siddz
Super User
Super User

Thanks, @WarrenBelz! That worked.

 

Here is a summary of the changes: 

 

 The OnChange property for the control on A_Different_DataCard:

If(
Self.Selected.Value = "Choice A",
UpdateContext({varReset:false});
UpdateContext({varReset:true})
)

 The multi-select control's DefaultSelectedItems property:

If(
varReset,
{Value:Blank()},
{Value:Parent.Default}
)

  The multi-select control's Reset property:

varReset

 Thanks, again!

Hello Team,

I have a customized PowerApps form. I have one Data card called Request Status in that I have a choice option (Assigned to Payables Team, Assigned to Disbursement Team, Rejected, Completed) i need to hide some DataCard (Requested by, Requested date etc). For that on selecting particular DataCard. On the visible property I used this formula. DataCard4.Selected.Value = "Assigned to Disbursement Team" Particular DataCard is hidden now. My question is If the analyst select Completed or Rejected then those hidden option should be visible. Pls help me. Refer screenshot for better understanding. 

On the Request Status, if the DataCard is selected as Assigned to Payables team then the yellow highlighted item got hidden.

On the Request Status, if the DataCard is selected as Assigned to Disbursement team the yellow highlighted item is visible.

On the Request Status, if the DataCard is selected as Assigned to Completed then the highlighted item should also be visible. 

 

Assigned to Payabes Team 1.JPGAssigne to Disbursement.JPGCompleted.JPG

@Jaleelford_123 ,

You might post that on a new thread - this one is closed.

OK

Hello Team,

I have a customized PowerApps form. I have one Data card called Request Status in that I have a choice option (Assigned to Payables Team, Assigned to Disbursement Team, Rejected, Completed) i need to hide some DataCard (Requested by, Requested date etc). For that on selecting particular DataCard. On the visible property I used this formula. DataCard4.Selected.Value = "Assigned to Disbursement Team" Particular DataCard is hidden now. My question is If the analyst select Completed or Rejected then those hidden option should be visible. Pls help me. Refer screenshot for better understanding. 

On the Request Status, if the DataCard is selected as Assigned to Payables team then the yellow highlighted item got hidden.

On the Request Status, if the DataCard is selected as Assigned to Disbursement team the yellow highlighted item is visible.

On the Request Status, if the DataCard is selected as Assigned to Completed then the highlighted item should also be visible.

 

Assigned to Payabes Team 1.JPGAssigne to Disbursement.JPGCompleted.JPG

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

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