0

Strikethrough text in formula

Hey you guys, I have the following problem: I'm using a formula to show text in red or white colour with the "styled" code. I want to add the "strikethrough" option in order to show that the information is over or done. The current code is this:

if 'status' = true then
    styled('position' , "red")
else
    styled('position', "white")
end

6 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 1 yr ago
    • Reported - view

    You can use CSS styling also:

    if status then
        html("<p style='background-color:red;color:white;text-align:center;text-decoration-line:line-through;'>" + position + "</p>")
    else
        html("<p style='text-align:center;'>" + position + "</p>")
    end

      • pirinisz
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Just tried it man, not working!!!! All records are in white and normal text!!!

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      pirinisz 

      Maybe there's something wrong in your code? On my end it works. The field containing the formula is a formula field, the field 'position' is a text field and the field 'status' is a Yes/No field in my example.

      Though, the representation in the table view is not styled. If this what you wanted, I have no solution because the styled() function doesn't alow text decorations (strikethrough).

      • pirinisz
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Well actually the field "position" is a reference to a table record field!! I dunno if that messes the code up....!!!

      "Though, the representation in the table view is not styled. If this what you wanted,..." no this is not what I wanted!! I want the same thing you show in your photo!!

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      pirinisz Strange... What do you get if you put the position field in a variable?

      let txt := text(position);
      if status then
          html("<p style='background-color:red;color:white;text-align:center;text-decoration-line:line-through;'>" + txt + "</p>")
      else
          html("<p style='text-align:center;'>" + txt + "</p>")
      end

      • pirinisz
      • 1 yr ago
      • Reported - view

      RoSoft_Steven OK I made it work, but as you mentioned before it won't show in table view!!! Nevertheless the first code I used (styled....) DOES show in table view, so I guess I'll have to figure that one out!!!!! Thanks anyway!!!

Content aside

  • 1 yr agoLast active
  • 6Replies
  • 64Views
  • 2 Following