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

Number text format dont allow decimals or negatives

I have a data card field that I have set to Format: TextFormat.Number

 

However, when testing this it works perfect for preventing users inputting strings but if they enter negative(-12) or decimal (2.4)

it still work.

 

For this field I need the input to be whole number only. How may I check and then round the decimals or trim the - symbol? 

 

I can make warning signs and don't let them press submit. But I would really prefer to limit what can be typed in.

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@miss_haley 
You have to make 'warning signs' as you mentioned.  There's no way to prevent typing a valid number.

 

You can restrict input values by using another control type like a pre-defined dropdown of numbers or a Slider control.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

5 REPLIES 5
mdevaney
Super User III
Super User III

@miss_haley 
You have to make 'warning signs' as you mentioned.  There's no way to prevent typing a valid number.

 

You can restrict input values by using another control type like a pre-defined dropdown of numbers or a Slider control.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

@mdevaney 

 

to check for negative and show error I can type

If(Value(TextInput1.Text) < 0)

 

Would you know how I can check for the decimal?

I dont know how I can check if "." exist in the textinput

 

@miss_haley 
I think you can check for a decimal like this

Mod(your_number_here, 1)<>0

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney 

 

Thanks for reply, I use the IsMatch function and look for decimal as a regex pattern it work. 

@miss_haley 
Yes, that works too.

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

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (48,172)