CalcBuilder Forum

Change color depending on result

User dhoeke 2017-08-26 08:19:09

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 2017-08-26 09:20:16

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 2017-08-31 13:30:39

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 2017-09-01 10:19:22

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

Regards

...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!
...
List Manager

Build different lists for your site

Buy now!