Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

Conditional field (colors) 05.07.2017 12:58

Hi, have been using your component several times, really great!

I do have a question, I have an excel sheet, and based upon the result of a calculation, the output is in red color or green color. How do I translate this to the component?

Thanks in advance!
Jeff

Re: Conditional field (colors) 05.07.2017 15:56

Hi,
the simplest solution would be to create an additional result, let's call it

$color_result

so you will set it to the right css color value. At the code you can set the desired value using conditional expressions or any other structure needed, for ex:

if($myresult>100){
$color_result="#ff0000"; //red
}
else{
$color_result="#0000ff"; //blue
}

at the output section you can use this new result to set the style of that specific section, that you can place inside a span, div, etc

span style="color:##color_result##;"

##myresult##

...

If you're using extended version and the excel mapping instead of the code, you can map another result to one additional cell, that will contain color value same as above, calculated with excel if expressions as well.

Hope this helps, regards
Moonsoft Team
www.moonsoft.es

Re: Conditional field (colors) 25.07.2017 18:31

Thanks for your quick reply.

I understand your explanation. Only thing is; where do I put that code? In Javascripts events, Executed after calculation?

Because my code would be like this:

if($GLOBE>$threshold){
$color_result="#ff0000"; //red
}
else{
$color_result="#008000"; //green
}

Only if the calculated Globe-score is higher than the threshold (also calculated based upon other variables); it would have to turn red.

Re: Conditional field (colors) 25.07.2017 19:00

Sorry, managed to find it and get it working. Thanks!!
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback