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.

getting a piece of text...

Featured Replies

Hi,

I have a text field witch is populated with the following text:

Macintosh HD:Users:Admin:Pictures:Adressbook:picture.jpg

Now I only want to extract the last word. In this case it would be "picture.jpg". The calculation would be rightwords(textfield,2). But the problem is that the file could have a compleet different filename.

Does somebody know how to search for the last ":" character and filter the filename out?

thnx & greetz,

Jeffer

  • Author

whoop...found it myself:)

Right(textfield, (Length(textfield)-Position(textfield, ":", "0", PatternCount(textfield, ":"))))

greetz,

Jeffer

Jeffer,

The way you've found will work - but for the sake of interest, there are several other options also.

Provided your filenames don't include spaces or underscores (or other non alphanumeric characters apart from dots and dashes) you could use:

RightWords(textfield, 1)

- which will lift out picture.jpg or any other file name in that format. Note that it's a 1 not a 2 because the dot is not recognised as a word separator.

Alternatively, if you need to cater for underscores of spaces in the filenames, you could use:

Right(textfield, Length(RightWords(Substitute(Substitute(textfield, " ", "X"), "_", "X"), 1)

and, last but not least, along similar lines to the calc you arrived at, you could use:

Right(textfield, Length(textfield) - Position(textfield, ":", Length(textfield), -1))

wink.gif

  • Author

Hi Ray,

Thanks for the reply...i like looking over some calculations again to really understand how they work:)

The first calc "RightWords(textfield, 1)" is a nasty one since you will never know what filename you're working with;)

The second one "Right(textfield, Length(RightWords(Substitute(Substitute(textfield, " ", "X"), "_", "X"))"

i don't really understand. Where do you need those "X" for?

greetz,

Jeffer

Hi Jeffer,

The use of Substitute is changing any spaces or underscores to 'X' before grabbing the rightmost word to check the length (which is then fed into the Right( ) function). This is because spaces and underscores are counted as word separators but can be included in field names, so changing them for an 'X' before testing for the length of the field name ensures that the whole name will be captured.

Cheers,

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.