Skip to main content
CalcBuilder logo
CalcBuilder Forum

Change color depending on result

User dhoeke

I have results of a calculation showing in a table. What I would like is:
If result is 6 or greater then color is green.
If result is

Edited by dhoeke - 26.08.2017 08:20

Moonsoft support

Hi,
please note the forum has some character restrictions due to security reasons, that's why you see the content is incomplete. We assume you want to change dynamically the color of one output section, you can achieve this applying a dynamic style at the output, for ex:

td style="color:##resultcolor##"

and then you can 'calculate' the $resultcolor at the code section, using an 'if' structure:

if($calculatedresult>=6){
$resultcolor="#308B30";
}
else{
$resultcolor="#801515";
}

Hope this helps, you can place a ticket at the helpdesk in case you need further help, there we can share code without restrictions.

Regards

User dhoeke

Many thanks. In the end I had to work with this:

td style=color:$resultcolor

+ the calculation

But that worked.

Edited by dhoeke - 31.08.2017 13:32

Edited by dhoeke - 31.08.2017 13:32

Moonsoft support

Hi,
ok, great it worked, thanks for sharing!

Regards

User dhoeke

Close

Moonsoft support

Closed ticket

...
List Manager

Build different lists for your site

Buy now!
...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!