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

Clearing certain text

Hi,

 

Is it possible to clear certain texts (eg remarks and updated date)when I click the button? This means that other texts remains unchanged.

 

Edina_0-1614765114412.png

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User III
Super User III

@Edina 

On your button to clear, you can add the following formula:  UpdateContext({lclClearInfo:true})

 

Now in the items that you want to clear, set the Default property to:

If(lclClearInfo, Blank(), Parent.Default)

 

Make sure that on your OnSuccess of the form you set the variable back to false:

UpdateContext({lclClearInfo:false})

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

timl
Super User III
Super User III

Hi @Edina 

In answer to your question - yes, this is because you're editing the data. The reset function will reset the field back to the initial value. Therefore, this would work for a form in new mode, but not in edit mode.

In this situation, I would recommend Randy's method.

You might consider combining both of these techniques. That is, you would set the formula for the button to this:

UpdateContext({lclClearInfo:true});
Reset(txtRemarks);
Reset(txtUpdatedText)

What this will do is if a user were to click the reset button twice whilst editing a record, the reset process will work during the second time.

The final note is that if you are using a form, you'll need to add this reset button inside of the form.

View solution in original post

timl
Super User III
Super User III

Hi @Edina 

Just to clarify, have you set the default properties of RemarksTextInput and  DataCardValue116 to the following?

If(lclClearInfo, Blank(), Parent.Default)

 

View solution in original post

12 REPLIES 12
timl
Super User III
Super User III

Hi @Edina 

You should just be able to called reset function on the controls that you want to reset.

https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-reset

For example,

Reset(txtRemarks);
Reset(txtUpdatedText)
Edina
Helper I
Helper I

Hi @timl ,

 

This does not work for me. Is it because the data is in sharepoint and I am editing the data?

RandyHayes
Super User III
Super User III

@Edina 

On your button to clear, you can add the following formula:  UpdateContext({lclClearInfo:true})

 

Now in the items that you want to clear, set the Default property to:

If(lclClearInfo, Blank(), Parent.Default)

 

Make sure that on your OnSuccess of the form you set the variable back to false:

UpdateContext({lclClearInfo:false})

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

timl
Super User III
Super User III

Hi @Edina 

In answer to your question - yes, this is because you're editing the data. The reset function will reset the field back to the initial value. Therefore, this would work for a form in new mode, but not in edit mode.

In this situation, I would recommend Randy's method.

You might consider combining both of these techniques. That is, you would set the formula for the button to this:

UpdateContext({lclClearInfo:true});
Reset(txtRemarks);
Reset(txtUpdatedText)

What this will do is if a user were to click the reset button twice whilst editing a record, the reset process will work during the second time.

The final note is that if you are using a form, you'll need to add this reset button inside of the form.

View solution in original post

Edina
Helper I
Helper I

hello @timl 

 

I am trying this code. However my remarks and updated date is a card. So am I suppose to use the card or the text input?

UpdateContext({lclClearInfo:true});
Reset(RemarksCard);
Reset(UpdatedDateCard)

OR

UpdateContext({lclClearInfo:true});
Reset(RemarksTextInput);
Reset(UpdatedDateTextInput)

 

timl
Super User III
Super User III

Hi @Edina 

It would be the text input that you would use:

UpdateContext({lclClearInfo:true});
Reset(RemarksTextInput);
Reset(UpdatedDateTextInput)

Hi @timl 

 

I am unable to do it. Are you able to advise me on what to do? When I click the button, Nothing happened and an error pops up, following is the error.

Edina_0-1614850380221.png

Note: the Updated Date is a date picker while Remarks is a text input

 

timl
Super User III
Super User III

Hi @Edina 

One issue is that you've referred to RemarksTextInput.Text, which should just be RemarksTextInput.

Reset(RemarksTextInput);

 Also, your button4 control should be a child item of the form if you're resetting controls inside the form. At the moment, it appears to be outside of the form.

Hello again @timl 

"Also, your button4 control should be a child item of the form if you're resetting controls inside the form. At the moment, it appears to be outside of the form." regarding this, how can I do this? when I click on the Form and insert a Button, its automatically out of the form.

 

I have tried adding a new custom card and added the button in. However, when I run and click on the button, nothing was cleared.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (66,051)