AnsweredAssumed Answered

CA PPM GEL datatype change

Question asked by JMSnider on Mar 8, 2016
Latest reply on Mar 8, 2016 by JMSnider

I have CA PPM On Demand. I am writing a GEL script to fetch timesheet data and then create a CSV file.

When I create the variables, I make them float. When the data is assigned from the query, it changes it to BigDecimal.

That's not a problem.

The problem is: when a BigDecimal is added to a BigDecimal, the result is type long, and the result is truncated.

For example: 5.25 + 4.00 = 9

Does anyone out there have any ideas?

<core:if test="${currWorkDay=='2'}">

         <gel:log level="INFO" category="JMS"> [${i}] 2-25  floatlastMonHours(${floatlastMonHours}) + floatcurrMonHours(${floatcurrMonHours}) = floatlastMonHours+floatcurrMonHours (${floatlastMonHours+floatcurrMonHours})</gel:log>

         <core:set value="${floatlastMonHours+floatcurrMonHours}" var="floatlastMonHours"/>

         <gel:log level="INFO" category="JMS ">same week same day after add - ${floatlastMonHours} floatlastMonHours.getClass().toString() => ${floatlastMonHours.getClass().toString()}</gel:log>

</core:if>

Log entries:

 

     [JMS ]first record - floatlastMonHours.getClass().toString() => class java.math.BigDecimal   

     [JMS ]assign query data to floatcurrMonHours - floatcurrMonHours.getClass().toString() => class java.math.BigDecimal

     [JMS][1] 2-25 floatlastMonHours(5.25) + floatcurrMonHours(4.00) = floatlastMonHours+floatcurrMonHours (9) 

     [JMS ]same week same day after add - 9 floatlastMonHours.getClass().toString() => class java.lang.Long

Outcomes