thead Posted June 24, 2022 Report Share Posted June 24, 2022 Is there a "style" or number format in a tabular data page that makes negative numbers red? Quote Link to comment Share on other sites More sharing options...
0 April Posted June 24, 2022 Report Share Posted June 24, 2022 Hi Thead, For you to change the number format in a tabular data page and change the color of negative numbers to red, please follow the below steps: - Instead of showing the column with negative values, create an HTML block. - Click source or disabled the HTML editor. - Copy and paste this script. <div id="mydiv[@field:ID]"></div><SCRIPT LANGUAGE="JavaScript"> if ("[@field:Value]" <0){ document.getElementById("mydiv[@field:ID]").innerHTML ="<span style='color:red;'> [@field:Value] </span>"; } else{ document.getElementById("mydiv[@field:ID]").innerHTML ="[@field:Value]";} </SCRIPT> Hope this helps. Queso 1 Quote Link to comment Share on other sites More sharing options...
0 Queso Posted June 24, 2022 Report Share Posted June 24, 2022 Hi! Thank you for this! Now I can turn my negative numbers in red! Just want to add a related thread: Have a good day! Quote Link to comment Share on other sites More sharing options...
0 autonumber Posted July 7, 2022 Report Share Posted July 7, 2022 Hello! You can also refer to this post: Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted August 25, 2022 Report Share Posted August 25, 2022 Hello! You can also use this script. Just paste it in the Footer. <SCRIPT LANGUAGE="JavaScript"> var elems = document.querySelectorAll("td[class^='cbResultSetData']"); for (var i=0, m=elems.length; i<m; i++) { if (elems[i].innerHTML.charAt(0) == "-") { elems[i].style.color="red";} if (elems[i].innerHTML.charAt(0) !== "-") { elems[i].style.color="black";} } </SCRIPT> Quote Link to comment Share on other sites More sharing options...
Question
thead
Is there a "style" or number format in a tabular data page that makes negative numbers red?
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.