Length()

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 8 Functions and Scripts Desk Reference
FileMaker 8 Functions and Scripts Desk Reference
ISBN: 0789735113
EAN: 2147483647
Year: 2004
Pages: 352
Simiral book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net