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() with textfont() bug?

Featured Replies

  • Newbies

When using the Substitute() function to change the font of some of the text in a field, the entire field changes fonts if the searchString includes the first character of the text in the field.

For example:

Create a database, "myDB", with a field, "myText", containing the text "some text", formatted with the Courier font.

Create a script:

Set Field [ myDB::myText ; Substitute ( myDB::myText ; "some" ; TextFont ( "some" ; "Arial" ))]

Run the script. You should see ALL the text in the field change to Arial font.

Change the formatting back to Courier, then change the script so it subtitutes "ome" instead of "some".

Set Field [ myDB::myText ; Substitute ( myDB::myText ; "ome" ; TextFont ( "ome" ; "Arial" ))]

Run it. It works as expected with only the letters "ome" changing to Arial, not the whole field.

What gives? Am I using the wrong script steps and/or function?

What gives? Am I using the wrong script steps and/or function?

No, that's gotta be a bug. Oddly, if you put the 2nd "some" into a global field, it also works fine:

Set Field [ myDB::myText ; Substitute ( myDB::myText ; "some" ; TextFont ( myDB::gSome ; "Arial" ))]

You may use another Substitute step also B)

Substitute(Substitute("|Fm7Trick|"& myDB::myText ; "some" ; TextFont ("some" ; "Arial" ));"|Fm7Trick|";"")

smirk.gif

Still odd though

  • Author
  • Newbies

Tricky. I follow what you mean - replace "some" with "|Fm7Trick|some", change the font for "some", then replace "|Fm7Trick|" with "". Sounds like it should work ... but it doesn't. I still end up with all the text in the field being changed to Arial font.

However, taking that idea and changing it some, I was able to come up with something that does work:

Substitute ( myDB::myText ; "some" ; TextFont ( "" ; "Courier New" ) & TextFont ( "some" ; "Arial" ))

By adding a piece that changes the font of "" to what I want the main body of text to be, I'm able to circumvent the bug. smile.gif

  • 2 months later...

Fixed in FMP 7.0v3.

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.