1 of 1 people found this helpful
The GetAsCSS() function will let you know what formatting, if any, is present in a string. Thus you would use GetAsCSS() on the contents of the field.
One approach to create a calculation to answer if the field contains any formatting (style, font, font size, or color) is to compare the results of GetAsCSS() on the original string to GetAsCSS() on the string stripped of any formattting.
For example you can use this calculation where MyField is the field you are examining. 1 = field is unformatted. 0 = field has some formatting.
[original = MyField;
Plain = TextFormatRemove(original)
Length(GetAsCSS(original)) = Length(GetAsCSS(Plain)); 1;
You could also compare the equality of GetAsCSS() results directly instead of checking the equality of the lengths, but I expect that just checking the lengths would be faster for larger strings.
If you trust that the default value of GetAsCSS() for unformatted strings won't change, you can use the fact that it simply adds 24 characters of CSS boilerplate to the original unformatted string. Any formatting will increase the length of the CSS.
[theField = MyField
Length(GetAsCSS(theField)) - Length(theField) > 24; 0;
Thanks for your replies. As often happens, I have pulled in another direction for the last week. I will try to experiment with your suggestions over the next couple of days.