Copy link to clipboard
Copied
I am concatinating two fields with a text string using the following as a custom calculation:
event.value = "Words" + this.getField("D1").valueAsString + this.getField("F1").valueAsString;
Field F1 is actually a numeric value. I would like to chnge the fomrattign of how F1 appears for readinility. Something as simple as making it bold would be enough, but also increasing the font size would be good as well.
I do not want to change the formatting of "Words" or D1 so I don't think I can do with global formatting.
Is it possible because F1 is a number I could use soem conditional statment to bold only numbers in event.value?
Don't forget to mark this solution as correct answer.
Copy link to clipboard
Copied
Problem Solved by rjunke
Here is the solution provided that worked
"Try something like this:
Place the conditional script in the number field and have it output to the text field. You'll need to use an array() to get the conditional formatting you want.
I created a number field formatted as a number and created a text field with no formatting. In the number field I added this custom calculation script:
var v = this.getField("Number1").valueAsString;
var spans = new Array();
spans[0] = new Object();
spans[0].text = "Words: ";
spans[0].fontWeight = 400; // normal weight
spans[1] = new Object();
spans[1].text = v; // insert the value we read from the field
spans[1].fontWeight = 800; // bold
var f = this.getField("Text16");
f.richText = true; // make sure we are dealing with a rich text field
f.richValue = spans;
The array gets written to the text field as richtext.
Hope this helps."
Copy link to clipboard
Copied
Don't forget to mark this solution as correct answer.