Brian Dunning's FileMaker Custom Functions

BoldItalicEncode ( Text )

Encode any bold or italic text with tags

  Average rating: 4.4 (36 votes) Log in to vote

Tom Robinson   Tom Robinson

Share on Facebook Share on Twitter

  Sample input:
BoldItalicEncode ( "hello. this is bold, this italic, and this both" )
  Sample output:
hello. this is [bold], this {italic}, and this [{both}]

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Wrap any bold text in the input text with square brackets, and italic text with curly.

This particular custom function was written for converting formatted text to something a web database could use. You could modify it to generate HTML tags from formatted text too.

It's also a particularly fiendish example of using the evaluate function.

 

Comments

Paolo   Paolo, milano
Mar 2, 2015
Hello,

that is exactly what I was looking for.

Tried to convert to italian (my fm pro version). But I always get an error executing it ("missing field or "(" )

CercaeSost(
Valutazione(CercaeSost(RicavaComeCSS("CIAO");
["\"";"\\\""];
["[";"("];
["]";")"];
["{";"("];
["}";")"];

["<SPAN STYLE= ";"Dichiara([w=\""];
["</SPAN>";"\";

p=Posizione(w;\">\";1;1);
s=Sinistra(w;p-2);
t=Destra(w;Lunghezza(w)-p);
b=ContaRicorrenze(s;\"font-weight: bold\");
i=ContaRicorrenze(s;\"font-style:italic\")];
Casi(2*b+i;\"\";\"{\";\"[\";\"[{\")&t&Casi(2*b+i;\"\";\"}\";\"]\";\"}]\"))&"])&"\"\"");

["<BR>";"¶"];
["&amp;";"&"];
["&eacute;";"é"];
["&gt;";">"];
["&hellip;";"…"];
["&iuml;";"ï"];
["&lsquo;";"‘"];
["&ldquo;";"\“"];
["&lt;";"<"];
["&mdash;";"—"];
["&ndash;";"–"];
["&quot;";"\""];
["&rsquo;";"’"];
["&rdquo;";"\”"]
)


Any suggestion ?
Many thanks,
Paolo
 
The Author   The Author, New Zealand
Mar 2, 2015
From a quick glance you've got extraneous spaces, e.g. 't=D estra', '[& quot'.
 
Orlando   Orlando, Berkeley, CA
Jul 1, 2015
Hello Tom,
Thank you so much again for this great custom function! It has served us nicely throughout these years while using FileMaker 11!

For some reason I'm not able to running it under FMP 13. I get a question mark and this error message:
'A number, text constant, field name or "(" is expected here.

Any idea what could be going on?

Thanks a lot!

Orlando
 
Chris   Chris, Worcestershire UK
Aug 5, 2015
This stopped working for me in FileMaker Pro 14, and I just work out why: http://help.filemaker.com/app/answers/detail/a_id/14502/~/filemaker-pro-14-and-filemaker-pro-14-advanced-release-notes

The top note (1.a) explains that the newer version no longer gives the tags as capitals, but as lower case. So, we need to change the tags to lower case as well. Specifically:
["<SPAN STYLE=";"Let([w=\""];
["</SPAN>";"\";
becomes:
["<span style=";"Let([w=\""];
["</span>";"\";
and
["<BR>";"¶"];
to:
["<br>";"¶"];
Making these changes got it working for me again.

Thanks so much to the author of this function, and to this great site for hosting it.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.