Creating variable with conditions using DomEL

I have a 3 Variables Percent, Td and Cd. Td and Cd are Integers with count calculation. The Percent variable should have value as (Cd/Td)*100. It works fine with this. But I have a situation where I need to define that If Denominator (Td) == 0 then return -1 or anything so that I can assign particular color in my Heatmap. The problem is out database doesn't  return anything if there is no entry. So, I am not able to write a condition where I can say If(Td==null) color :'red'. So I have a to assign some fixed values for those cases where the Denominator will be 0 which is technically undefined. I am creating the percent variable with following condition and directly assigning it as measure on my Heatmap. I am not getting any values generated for Heatmap and thus default. Can anybody help me to get this peice worked out. Thanks in advance 


<span style="font-size:14px;"><variable name="Percent" class="java.lang.Integer" calculation="Average">
<variableExpression><![CDATA[($V{Percent} == (($V{Cd}/$V{Td})*100)) ? 
( (($V{Cd}.equals(0)&& !$V{Td}.equals(0)) || (!$V{Cd}.equals(0)&& !$V{Td}.equals(0)))) 
:  (($V{Percent} == -1) ? ($V{Cd}.equals(0) && $V{Td}.equals(0)) : ( (($V{Cd}.equals(0)&& !$V{Td}.equals(0)) || (!$V{Cd}.equals(0)&& !$V{Td}.equals(0))))    )
</variable> </span>

skatariya's picture
Joined: Feb 11 2015 - 12:38pm
Last seen: 4 years 4 months ago

0 Answers:

No answers yet