The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Allow only whole numbers in a variable

Rylie Markle
Tera Contributor

I want to write a catalog client script on a record producer that allows only whole numbers to be typed in a variable field. I have a script written that gives an error message if a decimal point is included in what they type, but the problem with this is they can't type a number with .0 at the end, which would be a whole number. 

What would be the best way to make sure they have to type in a whole number, but they can still type in .0? My current script is below. Any ideas are appreciated. 

 

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

Hello ,

You can add one more AND condition to your if loop saying 

if(inputValue.includes('.') && !inputValue.includes('.0'))

i tried this and it worked for me.Please try this thing and let me know and

Please don't forget to mark this helpful or accept the solution if it helps you 

View solution in original post

5 REPLIES 5

Thank you, that's exactly what I needed!