cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Preeti1234
Frequent Visitor

How to Validate Temperature field in Powerapps

Hi PowerApps Community Members,

 

I have a SharePoint List. In that list, I have one column named "Temperature"(Single Line of Text data type).

 

As per my requirement, I want to validate this temperature field in my Powerapps form. I have added the Temperature field in my Powerapps form, but can not validate it.

Temperature validation means I want to put a range (Suppose, the range between 98 to 105). Also, the temperature may appear with decimal value as like 98 or 99.6, 100 or 100.8, 101.2, and up to 105. If not, then it will give a warning message.

 

Can anyone help me with this problem? Thanks in Advance!!!

1 ACCEPTED SOLUTION

Accepted Solutions

Based on your new figures / request, I tested:

 

If you want to give a warning message:

If(Value(Substitute(TextInput5_2.Text,"C",""))<34 Or
Value(Substitute(TextInput5_2.Text,"C",""))>40,
Notify("The Temperature Should Be between 98 and 105"))
 
If you want to fill color the Textbox as a warning:
If(Value(Substitute(TextInput5_2.Text,"C",""))<34 Or
Value(Substitute(TextInput5_2.Text,"C",""))>40,Red,White)
------------

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.

View solution in original post

9 REPLIES 9

use Power Automate on create or on update of records and send an alert if the temperature is outside of the desired range. Could be email, push notification or text sms using connector like Twilio

WarrenBelz
Super User
Super User

Hi @Preeti1234 ,

On the OnChange of the field, put this (replace with your text box name)

If(
   Value(YourTempControlName.Text) <98 ||
   Value(YourTempControlName.Text) >101.2,
   Notify(
      "Entry outside range between 98 and 101.2",
      Error
   );
   Reest(YourTempControlName)
)

 

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.

 

eka24
Super User
Super User

If you want to give a warning message:

If(Value(TextInput1.Text)<98 Or Value(TextInput1.Text)>105,
Notify("The Temperature Should Be between 98 and 105"))
 
If you want to fill color the Textbox as a warning:
If(Value(TextInput1.Text)<98 Or Value(TextInput1.Text)>105,Red,White)
------------

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.

Hi eka24,

Thanks for your reply.

Can you please suggest to me, Instead of taking the temperature value in F i.e. (range from 98 to 105), If I will display the value in C i.e. (range from 34C to 40C), then what will be the formula?

 

Note: The value should allow 34 C to 40C i.e in Centigrade in two decimal places. That means I can enter the value as 35.1 C, 38.5C, 40.3C (including C), etc.

 

Thank you!!

@Preeti1234 ,

If(
   Value(YourTempControlName.Text) >=34 ||
   Value(YourTempControlName.Text) <=40,
   Notify(
      "Entry outside range between 34C and 40C",
      Error
   );
   Reest(YourTempControlName)
)

 

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.

Hi WarrenBelz,

Thanks for your reply.

It seems the above formula is not working for me. I am applying this formula on a text box OnChange Property as like below screenshot:

Here, My DataCardValue5 = TempControlName

 

Image.png

 

When I am previewing this app and entering a value as 36.6C, then the notification error is coming. Below screenshot is for your reference:

image1.png

 

Here, the entry value should be taken from 34C to 40C (Including C and decimal value like 35.5C, 38.8C, etc).

Can you suggest me if I am wrong?

 
 
 

Thank you!!

Based on your new figures / request, I tested:

 

If you want to give a warning message:

If(Value(Substitute(TextInput5_2.Text,"C",""))<34 Or
Value(Substitute(TextInput5_2.Text,"C",""))>40,
Notify("The Temperature Should Be between 98 and 105"))
 
If you want to fill color the Textbox as a warning:
If(Value(Substitute(TextInput5_2.Text,"C",""))<34 Or
Value(Substitute(TextInput5_2.Text,"C",""))>40,Red,White)
------------

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.

Checking whether you are still having issues on the validation

------------

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.

Hi eka24,

 

Thank you so much for your help!!

This is exactly what I want.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,997)