AnsweredAssumed Answered

Possible BUG evaluating conditions

Question asked by xelnag on Aug 7, 2013
Latest reply on Aug 9, 2013 by xelnag
Hi,

So here i am, trying to do a simple thing like testing that a value that i get from DB is equal to 0 (taking into account possible decimals). Easy, i thought, and then this happened.

This is the output of my test script:

[color=#fa0202]zero...[color]

And this is the simple script:
<gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:core="jelly:core" xmlns:email="jelly:email"
    xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:sql="jelly:sql"
    xmlns:x="jelly:org.apache.commons.jelly.tags.xml.XMLTagLibrary"
    xmlns:xog="http://www.niku.com/xog"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <gel:setDataSource dbId="Niku"/>
   
   <sql:query var="get_units">


  SELECT 0.5 FROM DUAL
   </sql:query>         
   <core:forEach items="${get_units.rowsByIndex}" var="v_units">


<core:set value="${v_units[0]}" var="units"/>           
   </core:forEach> 


<core:choose>


<core:when test="${units== 0}">



<gel:out>zero... </gel:out>


</core:when>


<core:otherwise>



<gel:out>greater or less than 0 - otherwise</gel:out>


</core:otherwise>

</core:choose>
</gel:script>
Why is it giving a "zero" output when i have a 0.5 ?

Any ideas would be appreciated,
Thank you.

Outcomes