Forum Discussion
OK, try it like this:
def results = new XmlSlurper().parseText(jdbcResponse) .ResultSet.Row.collect{[transactionId: it.TRANSACTION_ID, transactionDate: it.TRANSACTION_DATE_KEY, transactionValue: it.TRANSACTION_VALUE, totalDiscount: it.TOTAL_DISCOUNT != '' ? it.TOTAL_DISCOUNT : 0, //... def arrayOfTagInfo = new JsonSlurper().parseText(restResponse) .transactions.collect{ [transactionId: it.transactionId, transactionDate: it.transactionDate, transactionValue: it.transactionValue, totalDiscount: it.totalDiscount,
//...
still no luck .. :'(
def results = new XmlSlurper().parseText(jdbcResponse)
.ResultSet.Row.collect{[transactionId: it.TRANSACTION_ID,
transactionDate: it.TRANSACTION_DATE_KEY,
transactionValue: it.TRANSACTION_VALUE,
totalDiscount: it.TOTAL_DISCOUNT.text()?:'0',
def arrayOfTagInfo = new JsonSlurper().parseText(restResponse)
.transactions.collect{ [transactionId: it.transactionId,
transactionDate: it.transactionDate,
transactionValue: it.transactionValue,
totalDiscount: it.totalDiscount.text()?:'0',
I get error - groovy.lang.MissingMethodException: No signature of method: java.math.BigDecimal.text() is applicable for argument types: () values: [] Possible solutions: next(), getAt(java.lang.String), wait(), wait(long), max(java.math.BigDecimal), wait(long, int) error at line: 26
for json definitions it gives error - line 26
ONE DOUBT - > ? I need to change in both the definitions - JSON & JDBC ? I am doing it correct ?