I’m having an issue, I am running a query to my DB. If I run this in pgadmin it’s returning just the number when I use case as float. However in Katalon and only in katalon it’s returning with a .0 if there is no decimal.
The field in the DB is numeric with two decimal places. so a 0 is 0.00, a 1.00. However in the application a 1 or 0 will display. Writing my query I can get pgadmin to return 1.00 as 1, using case and float. This allows for numbers like 3.4 to display properly but trimming off the extra 0.
Why is it doing this and how do I fix it in the query?
query example:
SELECT b.id,
l.number,
b.custnum,
cast(b.rb as float),
r.rbtype,
cast(b.qua as float),
cast (b.rb * b.qua as float) as charge
FROM billstuff b
LEFT JOIN lds l
ON l.id=b.loadid
LEFT JOIN rbtypes r
ON b.ratetypeid=r.id
WHERE l.number = ‘000000’
ORDER BY b.id asc;
This returns everything as expect in pgadmin.
my work around is in the test case it’s self
DBData dbldBillrow = findTestData(‘system/ldData_DB/loadBillrows_basedOnNumber’)
dbldBillrow.query = dbldBillrow.query.replace(‘000000’, loadPO)
dbldBillrow.fetchedData = dbldBillrowfetchData()
cR = dbldBillrow.getValue(4, iCB)
BigDecimal cRBD = new BigDecimal(cR)
BigDecimal cRBDs = cRBD.stripTrailingZeros()
String cR0 = cRBDs
Object cbBillR = WebUI.modifyObjectProperty(findTestObject(‘system/02 Dash/02 order/02 Cust Info/Fields and buttons/02_field_R’),
‘xpath’, ‘equals’, (‘id("billr’ + cBid + ‘")’), true)
cbBRV = WebUI.getAttribute(cbBillR, ‘value’)
WebUI.verifyMatch(cbBRV, cR0, false, FailureHandling.CONTINUE_ON_FAILURE)
this will work to compare what is in the field vs DB but i’d rather not have to do all the BigDecimal conversion in my script