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.

Extract text without unique suffix string?

Featured Replies

Hi

I'm trying to extract text from field using this calculation.

Let ( [

start = Position ( text ; prefix ; 1 ; 1 ) + Length ( prefix ) ;

end = Position ( text ; suffix ; start ; 1 )

] ;

Middle ( text ; start ; end - start )

)

The problem is that I don't have a unique suffix string. The prefix string is unique and I'd like Filemaker to extract the text between the prefix and the first occurrence of the suffix that comes after the prefix.

Did that make any sense?

/Johan

I might be helpful to see a before and after of your text.

How many possible suffixes do you have?

  • Author

Only one.

The suffix is always the same, but may occur several times through out the text.

Its's the text between the unique prefix and the first time the suffix occurs (after the prefix) that I want to extract.

Here is a simple example:

Steve likes Apple, Bill hates Apple.

Steve and Bill being the prefixes and Apple is the suffix.

/Johan

The calculation you have already does that.

  • Author

If I don't use a unique suffix the calculation field remains blank.

However if I change it to a unique suffix it extracts the text. Why is that?

I don't understand your question: the calculation returns " likes " when prefix = "Steve" and suffix = "Apple". If you change the prefix to "Bill" and leave suffix = Apple", the result will be " hates ".

  • Author

I'm sorry, my mistake. I accidentally put a -1 instead of 1

Let ( [

start = Position ( text ; prefix ; 1 ; 1 ) + Length ( prefix ) ;

end = Position ( text ; suffix ; start ; -1 )

] ;

Middle ( text ; start ; end - start )

)

It works fine now! :blush2:

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.