Hi, i have a formula which displays a stored value and wraps it in a span to change the colour.
({stage} == “Won” ? “
”.{accvalue}."
":{accvalue})
the issue i have is adding a further formula if the {stage} == “lost” how would i go about doing this?
is this a possibility in Kreporter?
Stephen,
when conditional statement becomes more complex than a simple if / else, best practice is to create a custom function in custom/include/custom_utils.php (create file if not present yet), pass the value in KReporter and return the formatted string.
Your function could look like
function kreporter_opportunities_stage_color($stage = “”){
switch($stage){
case ‘Qualification’:
$stage = “< font color=‘red’>”.$stage."</ font >";
break;
case ‘Prospecting’:
$stage = “< font color=‘blue’>”.$stage."</ font >";
break;
default:
}
return $stage;
}
In Formula in KReporter you would have
kreporter_opportunities_stage_color({stage});
Please note that space I placed in font tag are only there to avoid the rendering of font tags is this post.
Val
Thank you Val. we have this working perfectly.