Nmenon81
7 years agoOccasional Contributor
Decimal values in JDBC and JSON
I am trying to compare 2 responses - one JDBC and other json. However, the decimal values in my JDBC show up like this:
<NUMBER_OF_UNITS>0.00000</NUMBER_OF_UNITS>
<MODE_PREMIUM>1200.00</MODE_PRE...
- 7 years ago
Without seeing your full JDC & JSON responses I'm not sure what more advice I can give. I recomend that you read up on the XMLSlurper (to understand how it returns GPaths) and the the JsonSlurper (to understand how returns Maps and/or Lists).
I did notice that the NodeChildren object has a text() method. You could try to see what this gives you, I've also added some log statements to help debugging:
class Model { def buildjdbcData(row){ log.info('Calling buildjdbcData') log.info(row.MODE_PREMIUM.text()) def FIELD7 = row.MODE_PREMIUM ? new BigDecimal(row.MODE_PREMIUM.text()) : row.MODE_PREMIUM return FIELD7 } def buildJsonData(tagInfo){ log.info('Calling buildJsonData') log.info(tagInfo.ModePremium.text()) def FIELD7 = tagInfo.ModePremium ? new BigDecimal(tagInfo.ModePremium.text()) : tagInfo.ModePremium return FIELD7 } }