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

Does anyone know an effective way to turn a text field into intials? Just the first letter of each word; names, for instance. I'm sure I could cobble together something clumsy with PatternCount and Left, but if anyone has an elegant solution, I would be delighted to hear it.

  • Author

Okay, for the record, this is what I am using now - it only works ona hard-coded maximum number of words (in this cae 4) so it's not teribly flexible or pretty. I guess I could just keep adding new "paragraphs" for each new word I want it to accomodate, but I'd still love to know if anyone has anything simpler:

Left(LeftWords(Employee Name, 1), 1)

&

If(PatternCount( Employee Name, " ") > 1,

Left( MiddleWords( Employee Name, 2, 1), 1)

, "")

&

If(PatternCount( Employee Name, " ") > 2,

Left( MiddleWords( Employee Name, 3, 1), 1)

, "")

&

If(PatternCount( Employee Name, " ") > 0,

Left( RightWords( Employee Name, 1), 1)

, "")

Hello McCormick,

There are certainly a few options that would be a little less onerous than what you are doing at present.

If you would prefer to use a calculation then there is no way (at least with present versions of FM - and without using a plug-in) to make it open ended - you will have to code for a defined maximum number of words in the field.

However you could do so with a somewhat more efficient calculation systax along the lines of:

Left(MiddleWords(TextField, 1, 1), 1) &

Left(MiddleWords(TextField, 2, 1), 1) &

Left(MiddleWords(TextField, 3, 1), 1) &

Left(MiddleWords(TextField, 4, 1), 1) &

Left(MiddleWords(TextField, 5, 1), 1) &

Left(MiddleWords(TextField, 6, 1), 1) &

Left(MiddleWords(TextField, 7, 1), 1) &

Left(MiddleWords(TextField, 8, 1), 1) &

Left(MiddleWords(TextField, 9, 1), 1) &

Left(MiddleWords(TextField, 10, 1), 1) &

Left(MiddleWords(TextField, 11, 1), 1) &

Left(MiddleWords(TextField, 12, 1), 1) &

Left(MiddleWords(TextField, 13, 1), 1) &

Left(MiddleWords(TextField, 14, 1), 1) &

Left(MiddleWords(TextField, 15, 1), 1) &

Left(MiddleWords(TextField, 16, 1), 1) &

Left(MiddleWords(TextField, 17, 1), 1) &

Left(MiddleWords(TextField, 18, 1), 1) &

Left(MiddleWords(TextField, 19, 1), 1) &

Left(MiddleWords(TextField, 20, 1), 1)

etc...

If you want to provide for the possibility that the field wioll contain hundreds or even thousands of words - and therefore you really need an open ended solution, I'd recommend that you consider setting the initials field with a script - such as the following example:

Set Field [ gCounter, 0 ]

Set Field [ Initials, "" ]

Loop

Set Field [ gCounter, gCounter + 1 ]

Set Field [ Initials, Initials & Left(MiddleWords(TextField, gCounter, 1), 1) ]

Exit Loop If [ gCounter = WordCount(TextField) ]

End Loop

where gCounter is a global number field.

Such a script will deal with an unlimited number of words in the TextField field (well, up to FileMaker's 64k limit, at any rate). But it will have to be triggered by the user, unless you happen have access to one of the various plug-ins that can trigger a script automatically whenever a particular field is edited (in which case it could be made to operate in a way that would be functionally equivalent to a calculation field).

  • Author

Yes, that seems to cover it. I think I'll just use the calc field for ten or so, it don't want to go all the way to a script. I knew there must be something smoother. Thanks!

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.