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

Clearing a Component's Value

Background:  I have an app that has 4 fields.  The first field is a lookup and the next three are text fields that rely on a keypad to input the data.  The keypad has a clear button that works great.  The issue I'm having is after a user submits a form, PowerApps doesn't reset the value of the componet's output back to blank.  As a result, the user has to go through and reclear every field before entering data.

 

Goal: Identify a way to reset the componet's value after submitting data outside of the componet's section.

 

I tried everything.  Someone please help!

 

Quick Summary of the solution:

 

Componet Side:

- I created a second property that was input w/ boolean type.  This was componet.clear1

- I added a toggle that on change set my variable to "" and set it's default to componet.clear1

 

App side: 

- I modified my submit button to include updatecontext blankit: true onselect

- Click the inserted componet and in the clear1 field i made it's value blankit

 

What happens: 

On submit blank it goes to true.  This changes the toggle to true which resets the variable to ""

 

 

- Create an updatecontext and set it to false

- Have the submit button change it to true onselect

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Clearing a Component's Value

@dyee4613 

This sample is super quick - so not a lot to it.  But it demos input and output on the components.  At least two types, string and boolean.  I threw in a table input property as well, but did not use it specifically - but you can see how the "default" is set on it to a default table.

 

I hope that it is a good sample.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

8 REPLIES 8
dyee4613
Level 8

Re: Clearing a Component's Value

Bump

dyee4613
Level 8

Re: Clearing a Component's Value

Sorry to keep bumping this but it is annoying me to no end and I think there is likely an easy solution.

Super User
Super User

Re: Clearing a Component's Value

@dyee4613 

What kind of actions have you attempted to make this work for you?

Unfortunately, there is not a great way to do this in the component itself.  You could put a reset property on it and reset values internally when set to true.  You might consider a toggle button in the component that can be set to true by that and then you can push it back to false after you clear.

What would be helpful would be a Reset ability for components. 

 

But...what have you tried so far?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
dyee4613
Level 8

Re: Clearing a Component's Value

@RandyHayes 

 

I started listing my failures when I had an epiphany.  I need to create a custom property that uses input rather than output.  This will allow me to have a true/false from the app that the componet can use to modify the original output.  The only issue is I don't really understand how the input feature works and I don't see anything explaining it from Powerapps.

Super User
Super User

Re: Clearing a Component's Value

@dyee4613 

Ah...I thought you might have tried the input parameters...yes, this is a good place to go with your issue.

 

So, you can create an Input parameter of any type you like.

In your component, you can reference it, by the ComponentName.YourParameter

 

You can also set its initial property.  Think about the Text Input box.  It has an input parameter called Default.  It is "set" to "Text input" by default.  You have that same level of control over your Input Parameters in a component.

If you create a text input parameter, you can set the value you want it to be "by default" - as if the hosting app never uses it or changes it.  

Then, in your Component, you can reference the parameter and use it as you need.  So, if the Component was Component1 and the parameter was Param1 (text), you could have let's say, a label, and set the Text property to Component1.Param1

If you wanted the Param1 to "default" to a value, then just go to that property in the designer and change it to the value you want.  So, for example, you could go to Component1, drop down the Param1 (or find in the properties panel) and change the value to something like "My default value".  Now your label will read "My default value".

If you now use this component in a screen (let's say it is named Comp1) , that label will read "My default value" when you first add it.  If you put a formula or static text in the Comp1.Param1, the component label will update to reflect that.

 

I hope that makes sense and is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
dyee4613
Level 8

Re: Clearing a Component's Value

@RandyHayes  This is super helpful but I don't think I completely followed it.  If it isn't too much trouble, can you create a real simple app showing this?  I set the value on my app but on the componet side it doesn't read it.  I think seeing an example would make it all come together pretty quickly. 

Super User
Super User

Re: Clearing a Component's Value

@dyee4613 

This sample is super quick - so not a lot to it.  But it demos input and output on the components.  At least two types, string and boolean.  I threw in a table input property as well, but did not use it specifically - but you can see how the "default" is set on it to a default table.

 

I hope that it is a good sample.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

dyee4613
Level 8

Re: Clearing a Component's Value

@RandyHayes 

The last horse has crossed the finish line.  I have a much better understanding of how componets work (100% thanks to you) and I was able to do the last update for my app.  It should now work properly!  Thank you soso much for your help on this project....and really any other project I'm working on in PowerApps. 

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

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