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.

Featured Replies

  • Newbies

As part of a much larger text calculation (in the style of a merge letter style solution) , I am trying to create a custom function that will substitute a tag/placeholder such as <<a or an>> with either "a" or "an" in the final calculation, which I think will need to based on a pre-defined list of words that would require one or the other.  From a grammar perspective, the use of the articles "a" or "an" is irregular, as it is based on if the subsequent word (most of the time at least) has a vowel sound (e.g., both "university" and "undone" start with the letter "u", but each requires a different article because one has a vowel sound when said aloud and the other doesn't.  So, I would expect to have to supply 2 lists of words within the custom function that (which I would update regularly), unless someone happens to know another way to do this.

Given a text calculation that might read something like: "The client's reading performance was found to be at <<a or an>> eighth grade level, while his math calculation skills were found to be at <<a or an>> first grade level. "  The first placeholder would be "an" and the second would be "a".  

Thank you.

 

I think you are looking at this the wrong way. In your example it makes no sense to substitute only <<a or an>> as they would never change based on the text. The substitution would always be the same. So, for your example to make sense, the words following <<a or an>> (ie, eight and fifth) would also have to be substituted. In which case it makes much more sense to do something like this:

"The client's reading performance was found to be at <<subst1>> grade level, while his math calculation skills were found to be at <<subst2>> first grade level. "

And substitute <<subst1>> with "an eight" and <<subst2>> with "a fifth". Whilst you are substituting you could check whether the word starts with a vowel or not and include "a " or "an " depending on whatever rule you define.

  • Author
  • Newbies

OlgerDiekstra,

You raise a good point, but this is just one part of a much larger calculation that does already have <<subst1>>  and <<subst2>>, which is determined by test scores and different descriptive terms that the end user decides.  So the reality is that the same sentence looked something like this originally: <<First Name>> <<Last Name>>'s reading performance was found to be at <<a or an>> <<subst1>>, while <<his or her>> math calculation skills were found to be at <<subst2>>.  

Since the end user can define what labels are being used for <<subst1>>, <<a or an>> cannot be calculated until the other text calculations have been completed first.  

Edited by Limbic_Response

You're making it more difficult than it needs to be. When you substitute <<subst1>> or <<subst2>> in your sentence:

"<<First Name>> <<Last Name>>'s reading performance was found to be at <<a or an>> <<subst1>>, while <<his or her>> math calculation skills were found to be at <<subst2>> "

you can determine <<a or an>> when you substitute. In which case you don't have <<a or an>> in your text, just <<subst1>>. So your user selects "eight" from a dropdown list, and right before you substitute in your CF you determine whether eight requires "a" or "an". The text then becomes:

"<<First Name>> <<Last Name>>'s reading performance was found to be at <<subst1>>, while <<his or her>> math calculation skills were found to be at <<subst2>> "

Something like: Substitute( $text; "<<subst1>>"; If( left( $term; 1 ) = "e"; "an "; "a " ) & $term )

You can make the If( left( $term; 1 ) = "e"; "an "; "a " )  into a custom function:

function repl_term( _term )
Case(
     Left( _term; 1 ) = "e"; "an ";
     Left( _term; 1 ) = "a"; "an ";
     Left( _term; 1 ) = "i"; "an ";
     Left( _term; 1 ) = "o"; "an ";
     Left( _term; 1 ) = "u"; "an ";
     "a "
    ) & _term

And then do Substitute( $text; "<<subst1>>"; repl_term( $term ) )

  • Author
  • Newbies

Ok, I understand now.  Yes, that should work in my solution!  Thank you OlgerDiekstra. 

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.