A user wrote into support asking how to set a maximum number of characters in a field. This is possible with a formula and access rule. I wanted to share the example more widely in case it’s useful to others.
Example doc: Limit Character Count - Grist
There is a short video on the right-hand side that you can watch that explains what I am about to explain here.
- The Max 20 Characters column is the column in which I would like to limit entries to a max of 20 characters.
- The Over 20 character? column is a formula column that is counting the number of characters in the Max 20 Characters column. If the character count is above 20, the formula returns
True, which is what we will prevent using access rules. The formula is
len($Max_20_Characters) > 20
- In access rules, I created a rule for this table to prevent the new record created after either an update or record creation from toggling the Over 20 character? column to
True. The rule is
newRec.Over_20_character_ == Trueand I denied Update
newRec variable is available for record/row creation and updating, and contains the state of a row after a proposed change, allowing you to selectively allow or deny certain changes.
In the video, you can see me test this rule with the text in the 21 characters column, which has exactly 21 characters. You can test this yourself by saving a copy of this example document.