Brian Dunning's FileMaker Custom Functions

ExtractLine ( TextField ; LineNumber )

Return a specific line out of a text field.

  Average rating: 4.5 (39 votes) Log in to vote

Michael Haymore   Michael Haymore
N/A
http://www.my-xanadu.net

Share on Facebook Share on Twitter

  Sample input:
ExtractLine ( "Red
Blue
White
Green
Black" ; 3 )
  Sample output:
White

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This is an easy way to pull a specific line of text out of a field that has it's data seperated by carriage returns. If you try to get a get a line of text that is not available, it will return a "?".

 

Comments

Chris Lord-Paquin   Chris Lord-Paquin, Manchester, NH
May 4, 2009
The above custom function works great, but does not pull the last value of the field. There must be a "¶" after the last value for the function to fully work. The following works properly.

Let ([
TextSource = TextField & "¶";
TextLine = Middle (TextSource; Position ( TextSource; "¶"; 1; LineNumber - 1) + 1;
Position ( TextSource; "¶"; 1; LineNumber) - Position ( TextSource; "¶"; 1; LineNumber - 1) - 1
)];

If ( IsEmpty (TextLine); "?"; TextLine)
)
 
Jo   Jo, brussels
Sep 25, 2015
wouldn't getvalue do the same ?
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.