I cant find anywhere the ability to stop users entering numbers after a decimal point.
I have a field where I have defined whole numbers only but if a user miss keys and enters a decimal number there is no way of stopping them.
As a stopgap I have created a second field showing two decimal points and making it the same as the original so at least we can see if someone has done this but we are entering some 1,000+ records a month so not ideal.
Is there a way in Knack I have missed or can this be done in Java (which I am a complete novice).
Hi Carl
Any numbers from 1-1,000. A miss key can produce say 265.1 and it will only show 265 as no decimal places are show, I need a way of validating to only whole numbers.
John
I’ve been thinking about this on and off all day I couldn’t find a way to make, as an example, 245.1 just show 245
I know that we can use zero decimal places so the value in the table shows “245” but when you click into it, it’s really “245.1”
I guess your just trying to remove the .1
Validation and Conditional rules don’t help for this situation. I even tried to see if I could do something with Integromat, before going to the cinema to see the new bond film
Round or ceil are a couple of useful functions but they just round the value up or down to the nearest whole number.
The reason I asked if there was a numeric range is that I have similar situation with a ceramic tiling company and the staff were often putting decimal places into the values.
The quantity was never going to be higher than 50/60 in my case, so I added a related table with numbers 1-100 and connected it to the parent table as a searchable field.
It seems a bit of a waste of 1,000 records to do the same, however, with the connection set as searchable users can type “23X” and get the range from 230-239 quickly to select the correct whole value.
From memory, I then had a number field with a conditional rule looking at the field so I capture the number as it was being used for a calculation.
Not sure if you could get around this with code but as I’m not a coder the above is all I’ve got
First thanks to you both for your prompt reply and input which is very much appreciated.
Next… I cant make it work I have pasted the code as above with the field number substituted for the XXX but it makes no difference, still accepts and shows numbers after the decimal point.
There is one potential issue with just preventing the entry of a decimal point (the code above) and that is that it does NOT prevent the next numbers being added and so you could have a very wrong entry.
I have tried a few things and the best I have come up with is to have an Equation to work out if the number is a whole number:
AHA! Using inline table cell editing and not a standard form, that’s why it wasn’t working. Let’s see if we can have a go at covering that scenario.
And kudos to @JulianKirkness no code method worth considering above - may or may not be simple for inline table editing but I have a suspicion this could be the way to go given the inline editing needs.
OK this is where I am at. I have used another field as suggested above by Julian and it works a treat. I had tried something like this before with a Text Formula field and using the right function and looking something but 00 but that meant me displaying to users two decimal places which could cause confusion, Julians way is much better.
I was looking at a way of validation on input because I was trying to stay away from more calculation fields on this app as it is slowing down somewhat because of its complexity but I guess one more won’t hurt .
Thanks to you both for your time and effort on this one.
Julian, I am using this with great success, one thing I found out is that the “round” function is not supported nor advertised by knack so without you I wouldn’t have found it, so thanks again.