Post

6 followers Follow
0
Avatar

Is it possible to use text formatting in Calculation fields?

For example, can a certain word or phrase be specified to be in bold or italics?

Martin Boonzaayer

Please sign in to leave a comment.

11 comments

0
Avatar

Hello Martin,
You can use a javascript method to format or make calculation on your calculation fields.
For Bold string

var result = @your_text_field.bold()
result

/Hamid

Hamid 0 votes
Comment actions Permalink
1
Avatar

Hi,

you can also use markdown syntax for formatting.

var result =   "**" + @Field +"**" 
result 

makes the whole result bold. You also wrap substrings or words or whatever you want with asterisks or underscores

"1.   **bold** with 2 asterisks" + "\n" +
"1.  __bold__ with 2 underscores " + "\n +
"1. *italic* with 1 asterisks" + "\n" +
"1. _italic_ with 1 underscore"

will be shown as:
1. bold with 2 asterisks
2. bold with 2 underscores
3. italic with 1 asterisks
4. italic with 1 underscore

Rainer
rg@delos-consulting

Rainer Grabowski 1 vote
Comment actions Permalink
0
Avatar

Thanks Rainer,

I've tried the # for heading, and it's not working as planned.  What I would like to do, is have a calculation that converts a text field to a heading with line under.  It keeps returning the actual field name instead of the text field_80128623  nearest I can get is bold text

I've tried a number of things, and i just can't get it to work, which is probably my very limited knowledge coming into play, so any help would be appreciated.

I've tired variations of these and a few others, which work for bold, or as a straight text heading without using the field name - just can't get a heading using the filed name happening though

var result =   "**" + @Field +"**" 
result 

"#@Title111 \n--------------"

 

This works as a heading with a line break across the page, just can't get the field name in there

var dummy = @Event Name

"# EVENT DESCRIPTION AND LOCATION \n--------------"

 

 

 

Andrew Hopkins 0 votes
Comment actions Permalink
0
Avatar

Hi Rainer,

Hope you see this. Can we use markdown tables in calculation fields?

Adil Tuncer 0 votes
Comment actions Permalink
0
Avatar

Hi Adil,

Try this syntax

"Title1 | Title2" + "\n" + "--- | ---" + "\n" + @field1 + " | " + @field2
Hamid 0 votes
Comment actions Permalink
0
Avatar

Hamid, Thank you.

It worked. I had not put  "\n" , before. 

Now, it works. Thank you again.

Adil Tuncer 0 votes
Comment actions Permalink