Log In    |    Knowledge Base    |    4D Home
Tech Tip: Enforcing string length during data entry in 4D v11 SQL
Published On: December 18, 2009
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

In previous versions of 4D you could use string variables to automatically limit the length of a text string. When using Unicode mode in 4D v11 SQL, strings are automatically interpreted as text, limited only by the amount of memory used, not by the length in characters. A text variable can hold 2GB of data in Unicode mode.

In 4D v11 SQL you can limit the length of an entry string into a text variable to a certain number of characters using the entry filter property for this variable. For example, say we want to limit the length to three characters in the text variable named input_t.

In Entry Filter property for input_t, add three number signs ("#"):

Or in the Tool Box create an Entry Filter like this:

And then attach this Entry filter to the Entry Filter property:

The second approach is recommended because the filter needs to be changed only once and this will affect all objects where it is set.