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.

Substitute a 'pattern' in a string

Featured Replies

Hi,

I'm looking for a solution to find a 'pattern' in a string (not a value!), and then substitute it with another value. This substitution should be done through a script.

Practically, the string looks like this:

"99999 99999

99999 99999 99999 99999

99999 99999 99999

99999 99999 99999

99999 99999 99999 99999 99999"

Each of the 9-s above represents a number from 0 to 9. Each group contains 5 numbers.

I use this string (=field) to link this table to another one.

I would now like to limit the found records in the related table, by 'voiding' those lines in the string above that contain more than 3 groups of 99999-s.

The result-string should look like this:

"99999 99999

99999 99999 99999 x 99999

99999 99999 99999

99999 99999 99999

99999 99999 99999 x 99999 99999"

(x being a normal "x" to assure a value that has no related records, without deleting the line so that i can still re-use it afterwards)

Any profis around who ran into a similar thing?

rgds,

Each of the 9-s above represents a number from 0 to 9.

There is no pattern to find here. You should loop through the values, testing for the value's length. If it's more than 17, skip the value - otherwise include it in the result. This could be calculated using a custom function, or use a looping script to populate the result field.

  • Author

There is no pattern to find here. You should loop through the values, testing for the value's length. If it's more than 17, skip the value - otherwise include it in the result. This could be calculated using a custom function, or use a looping script to populate the result field.

Mmm, thanks Comment ... which means i need to check character for character on a 'return' to find out where the line starts and ends ... or is there an instruction that reads an entire line at the time as well?

Use the GetValue() function, in conjunction with a incrementing counter, e.g.:

Loop

Set Variable [ $i ; $i + 1 ]

Exit Loop If [ $ i > ValueCount ( SourceField ) ]

Set Variable [ $v ; GetValue ( SourceField ; $i ) ]

If [ WordCount ( $v ) ≤ 3 ]

Set Field ( TargetField ; List ( TargetField ; $v ) ]

End If

End Loop

Commit Records []

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.