Jump to content

Acronyms


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

Recommended Posts

I have a function with generates acronyms, handily found here. It needs refining to NOT give the first letter if the field has only one word. In that instance i just want the single word.

 

 

Acronym(type)

 

Case(

WordCount (type) > 1;
Upper ( Left (type; 1)) &
Acronym ( RightWords ( type; WordCount( type ) - 1));
Upper ( Left ( type; 1))
 
)
Assistance always appreciated.
 
Request for Information = RFI
Advice=Advice
 
Link to comment
Share on other sites

I have a function with generates acronyms, handily found here. It needs refining to NOT give the first letter if the field has only one word.

 

I would suggest you do this "refining" at the point where you call the custom function, not within the custom function itself.

 

 

Although if you really wanted, you could do it this way;

 

Acronym ( text ; result ) =

Let (
countWords = WordCount ( text )
;
Case (
countWords = 1 and IsEmpty ( result ) ; text ;
IsEmpty ( text ) ; result ;
Acronym ( RightWords ( text ; countWords - 1 ) ; result & Upper ( Left ( text ; 1 ) ) )
)
)

which has the further advantage of being tail-recursive - just in case you need an acronym that's more than 10k characters long...

 

 

--

 

BTW, where exactly is "handily found here"?

 

 

 

Filter ( Proper ( type ) ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) 

 

 

One wonders whether you know about umlauts... :hmm:

Link to comment
Share on other sites

BTW, where exactly is "handily found here

I thought my posted "solution" was one I found in these fm forums but was actually a Ray Cologon, NightWing Enterprises solution found at - http://www.briandunning.com/cf/33.

 

Comment, thanks for your alternative Custom Function although I had already decided to refine at the base calculation.

As for the function you suggested I am not sure how and what "result" is.

Link to comment
Share on other sites

Try

Case ( 
  WordCount ( type ) = 1 ; 
  type ; 
  Filter ( Proper ( type ) ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) 
)

Thanks. Always another way to skin a cat. Although apparently umlauts are important.

Link to comment
Share on other sites

This topic is 2860 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
 Share

×
×
  • Create New...

Important Information

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