Newbies esopher Posted July 25, 2004 Newbies Posted July 25, 2004 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?
The Shadow Posted July 25, 2004 Posted July 25, 2004 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" ))]
Ugo DI LUCA Posted July 25, 2004 Posted July 25, 2004 You may use another Substitute step also Substitute(Substitute("|Fm7Trick|"& myDB::myText ; "some" ; TextFont ("some" ; "Arial" ));"|Fm7Trick|";"") Still odd though
Newbies esopher Posted July 27, 2004 Author Newbies Posted July 27, 2004 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.
Recommended Posts
This topic is 7616 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 accountSign in
Already have an account? Sign in here.
Sign In Now