Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MergeFieldsB ( text ; openBrac ; closeBrac )

Featured Replies

Name & Parameters: [color:red][big] MergeFieldsB ( text ; openBrac ; closeBrac ) [/big]

Description: Much Better solution! Fills in Merge Fields embedded in a text string (<>). It works just like the Merge Fields you use in text in Layout Mode.

You can also substitute other kinds of bracketing characters for the double greater than and lesser than signs, "<<" and ">>". For instance, you could use square brackets like this: "[Field]".

This is a much more elegant solution than the other onethat I posted yesterday (MergeFields1 and MergeFields2). It just goes to show that if you spend too much time fiddling around instead of being productive, you might come up with something. (Yeah, and you might win the lottery, too.)

Sample Input:

<>

<>

Dear <>,

This really works well!

Cheers,

Jake

Results:

Dr. John Jakob Jingleheimer Schmidt, Ph.D.

300 Broadway

New York, NY 10239

Dear John Jakob

This really works well!

Cheers,

Jake

Recursive: yes

Formula:

Case ( PatternCount ( text ; openBrac ) > 0 ; 

Let ( subText = 

Let ( [

  openP = Position ( text ; openBrac ; 1 ; 1 ) ;

  openP2 = Position ( text ; openBrac ; 1 ; 2 ) ;

  closeP = Position ( text ; closeBrac ; 1 ; 1 ) ;

  Lgth = Length ( openBrac ) 

] ;

Replace ( 

    text ; 

    openP ; 

    closeP + Lgth - openP ; 

    GetField ( Middle ( text ; openP + Lgth ; closeP - openP - Lgth ) ) )

 //---end Let Function 2

 ) 



; MergeFieldsB ( subText ; openBrac ; closeBrac ) 

//---end Let Function 1 

) ;  



text 

//---end Case Function

) 

Required Functions: None

Author(s):B Jake Sterling

Date: 05/04/06

Credits:

Disclaimer:

FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.

Hi Jake,

You might have your CF account for a missing bracket somehow. It looks like it's going into an infinite loop if the first bracket is missing.

You could check my FieldSubstitute() CF on this from a couple years ago to see how I did it:

http://fmforums.com/forum/showtopic.php?tid/120434/

It's not perfect when dealing with a missing end bracket, but at least it does give some indication to the user. I couldn't really come up with a way to indicate a missing start bracket, but I was able to avoid the infinite loop.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.