Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7353 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

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?

Posted

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" ))]

Posted

You may use another Substitute step also B)

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

smirk.gif

Still odd though

  • Newbies
Posted

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...

This topic is 7353 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.