AnsweredAssumed Answered

TextStyleRemove not behaving as expected

Question asked by scubatel on May 30, 2016
Latest reply on May 30, 2016 by scubatel

I am developing a taxonomic database that requires that species names be in italic text, with some exceptions.  Words such as sp., spp., cf. and aff. are not strictly taxonomic terms and should be in plain text.  I have used TextStyleAdd to format the entire field to Italic and then attempted to use the Substitute function along with TextStyleRemove to revert the selected words above to Plain text.  However, the script had no effect but, when I changed the TextStyleRemove statement to TextStyleAdd I was able to format the selected words to a style such as Bold (still retaining their Italic style as well).

 

I finally found a work-around by nesting two TextStyleAdd functions, the first setiting the style to Bold and then to Plain and this removed both the Bold and the Italic formatting.  See below:

 

Set Field [TextStyleAdd ( Get(ActiveFieldContents) ; Italic )]

 

Set Field [Substitute ( Get(ActiveFieldContents) ;

["sp." ; TextStyleAdd (TextStyleAdd ( "sp." ; Bold ); Plain)];

["spp." ; TextStyleAdd (TextStyleAdd ( "spp." ; Bold ); Plain)];

["cf." ; TextStyleAdd (TextStyleAdd ( "cf." ; Bold ); Plain)];

["aff." ; TextStyleAdd (TextStyleAdd ( "aff." ; Bold ); Plain)]]

 

This seems to be a rather convoluted approach to the problem.  Is there a bug in Filemaker Pro 15 or am I missing something?

Outcomes