Category: Text
Syntax: Length ( text ) |
Parameters:
textAny expression that resolves to a text string.
Data type returned: Number
Description:
Returns the number of characters in the specified text string. Numbers, letters, punctuation, spaces, and carriage returns are all considered as characters.
Length() also serves a second function in that it returns the byte size of the object data found in a container field.
The Length() function is often used as part of data validation rules. For instance, if you want to make sure that users enter phone numbers with either 7 or 10 digits, you could set up a validation by calculation rule as follows:
Length ( GetAsNumber ( Phone )) = 7 or Length ( GetAsNumber ( Phone )) = 10
Examples:
Function | Results |
---|---|
Length ("Hello there!") | Returns 12. |
Length (LastName) | Returns 8 when LastName contains "Humphrey". |
Length ( Get (CurrentDate) ) | Returns 9 when the date is 3/27/2004. |
Note that in versions of FileMaker prior to 7, this last example would have returned 6, because the serialized numeric value for the current date would have been used (as opposed to the "3/27/2004)" formula). To achieve that same result, use the following formula: Length ( GetAsNumber ( Get (CurrentDate) )) | |
Length ( myContainer ) | Returns 156862 when the myContainer field holds an image that is approximately 157KB in size. (Operating systems report file size slightly differently. It is not unlikely that this function will return a slightly different number than that of your operating system.) |
: FileMaker Specifications
FileMaker 8 Product Line
Specifications and Storage Limits
Field Types and Import/Export Formats
: Calculation Functions
Working with Calculations Primer
Calculation Signatures
Calculation Functions
: Custom Functions
Custom Functions Primer
Useful Custom Functions
: Script Steps
Scripting Primer
Script Step Reference
: Quick Reference
FileMaker Error Codes
FileMaker Keyboard Shortcuts
FileMaker Network Ports
FileMaker Server Command Line Reference
FileMaker XML Reference
: Other Resources
Where to Go for More Information