Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2439 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

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.

 

Posted

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.

  • Newbies
Posted (edited)

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
Posted

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 )

This topic is 2439 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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