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

Powerapps field validation question

Question..... and i think im close....

 

I have a field called Temperature (number field in sharepoint).  I want to put a range that the users can enter into it.  I also added a label.  i added this code and it works EXCEPT the Reset part.

 

If(Value(Temperature)<90 || Value(Temperature)>105,

     UpdateContext({ShowErrorMsg: true}); Reset(Temperature),

     UpdateContext({ShowErrorMsg: false})

)

 

i want to put this code on the submit button so that the user can NOT submit if the user is out of range.

 

i done understand why im getting an error on the Reset part of this.  I get a "Invalid argument type (Number), expecting a control value instead."  Not sure what that means. This is the only part of my code that is giving me an error.  What am i doing wrong here?

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @cnorris135 ,

Please notice the Reset function's usage:

The Reset function resets a control to its Default property value.

So if you want to use this function, you need to pay attention to three points:

1)you need to reset a control, not a variable

2)you could not reset a control which has Default property, not including label control (not have Default property)

3)you need to use this function in one action property

 

Based on the formula that you provided, it seems like Temperature is a fieldname. So you got that kind of error message.

Could you describe more clearly about the feather that you want? Do you want to reset the textinput for Temperature field? or anything else?

If my assumption is right, you could try this:
Reset(Temperaturetextinput)           //please replace with your control name

 

Here's a doc about this function for your reference:

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

 

Best regards,

Community Support Team _ Phoebe Liu
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

3 REPLIES 3
eka24
Super User III
Super User III

Please you stated that Temperature is a Column in your list. What is the name of the Textbox to that users will enter the value 90.

The red error is that before you are reset a column instead of the Textbox

.------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

If this error is happening in the label then the reason is that Reset() can't be used in a label but it can be used in a button. If you add this formula to the button the error should go away.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
v-yutliu-msft
Community Support
Community Support

Hi @cnorris135 ,

Please notice the Reset function's usage:

The Reset function resets a control to its Default property value.

So if you want to use this function, you need to pay attention to three points:

1)you need to reset a control, not a variable

2)you could not reset a control which has Default property, not including label control (not have Default property)

3)you need to use this function in one action property

 

Based on the formula that you provided, it seems like Temperature is a fieldname. So you got that kind of error message.

Could you describe more clearly about the feather that you want? Do you want to reset the textinput for Temperature field? or anything else?

If my assumption is right, you could try this:
Reset(Temperaturetextinput)           //please replace with your control name

 

Here's a doc about this function for your reference:

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

 

Best regards,

Community Support Team _ Phoebe Liu
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

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

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

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (47,603)