Forum Discussion

AmyGosz1's avatar
AmyGosz1
Qrew Trainee
6 months ago

Display % sign in formula text field and color code

I have a formula text field to display text when a condition is met. This formula works fine and displays the % sign but it's just in black text. I would like to make the text red.

If(
[Indirect Exp Overide] > (0.1 * [Subtotal Applicable Items]),
"Indirect Expenses Override Amount is greater than 10% of the Subtotal Applicable Items amount")

However, when I add the color coding part of the formula, then it doesn't like the % sign and highlights it in yellow:

If(
[Indirect Exp Overide] > (0.1 * [Subtotal Applicable Items]),
<div style="color:red">"Indirect Expenses Override Amount is greater than 10% of the Subtotal Applicable Items amount</div>)

I have tried using '\' around  %  but that doesn't work. If I change it to the word percent, then the < in front of div is highlighted. I tried adding " in front of the <div> and at the end of </div> but that didn't help either.

If(
[Indirect Exp Overide] > (0.1 * [Subtotal Applicable Items]),
<div style="color:red">"Indirect Expenses Override Amount is greater than 10 percent of the Subtotal Applicable Items amount</div>)

What am I overlooking to get this correct? I want text red and % instead of percent....



------------------------------
Amy Gosz
------------------------------

6 Replies

  • Can you post the full formula and copy it here? The way you have it copied looks like it's a syntax error with using " versus '. I would expect something more like this where the entire string is wrapped in " and then the style is wrapped in '

    If(
    [Indirect Exp Overide] > (0.1 * [Subtotal Applicable Items]),
    "<div style='color:red'>Indirect Expenses Override Amount is greater than 10 percent of the Subtotal Applicable Items amount</div>")



    ------------------------------
    Chayce Duncan
    ------------------------------
    • AmyGosz1's avatar
      AmyGosz1
      Qrew Trainee

      HI Chayce....I made the adjustments you indicated and all the yellow highlighting went away, but now the statement showing on the form starts at includes the div tags  <div.....and is not in red. Here is my formula:

      If(
      [Indirect Exp Overide] > (0.1 * [Subtotal Applicable Items]),
      "<div style='color:red'>Indirect Expenses Override Amount is greater than 10% of the Subtotal Applicable Items amount</div>")



      ------------------------------
      Amy Gosz
      ------------------------------
      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        What type of field do you have it set as? Can you confirm it's a formula-rich text? 

        Is there other content in the formula besides this? 



        ------------------------------
        Chayce Duncan
        ------------------------------