FMPRO-L Archives

September 2010, Week 5

FMPRO-L@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jason L DeLooze <[log in to unmask]>
Reply To:
FileMaker Pro Discussions <[log in to unmask]>
Date:
Wed, 29 Sep 2010 11:10:10 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (38 lines)
Hi Emma,

Re-write Paul's CF to be recursive on each "line" of the text field by using the GetValue or LeftValues function to isolate the line and change its value.

Here's a set of custom functions to handle your problem, as I understand it.  As always, use with caution (on a backup).  There are 2 CFs.  The 1st one capitalizes the 1st letter of the 1st word and sets all other characters to lower case; the 2nd CF uses the 1st CF to recursively walk the multiple lines of the text parameter.

// Capitalize1stLetterOnly ( text )

Let(
   [
   text = Lower( text ) ;
   firstWord = LeftWords( text ; 1 ) ;
   pos = Position( text ; firstWord ; 1 ; 1 ) ;
   char = Middle( text ; pos ; 1 )
   ] ;

   Replace ( text ; pos ; 1 ; Upper( char ) )
)

===

// SentenceCaseByLine( textField )

Let(
   lineCount = ValueCount( textField ) ;

   Capitalize1stLetterOnly( LeftValues( textField ; 1 ) ) & 

   Case(
      lineCount > 1 ;
         SentenceCaseByLine( RightValues( textField ; lineCount - 1 ) )
   )
)

Regards,
Jason L. DeLooze
Annapolis, MD  USA

ATOM RSS1 RSS2