Jump to content
  • 0

Negative numbers in red



4 answers to this question

Recommended Posts

  • 0

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>

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]";




Hope this helps.

Link to comment
Share on other sites

  • 0


You can also use this script. Just paste it in the Footer.

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";}




Link to comment
Share on other sites

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.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...