I need to return a String value so I can build a object from another app via Restful. Part of my code the following snippet follows:
def searchProductionOrder (String sequentialNumber) {
def sql = Sql.newInstance(dbUrl, user, pwd, driverName)
String idProdOrder = sql.execute("""
SELECT production_order.idProdOrder
FROM production_order production_order
WHERE production_order.sequential_number LIKE ${sequentialNumber}
""").toString();
String url = ":8080/app2/api/productionOrder/"+idProdOrder
// call to Restful service
return Order
}
But the String url is always interpreted (and I printed it for testing) as:
url: :8080/app2/api/productionOrder/true
I need the idProdOrder String to return its value, not a boolean value. How can I do so?
Thanks in advance,
Instead of doing execute which will always return a Boolean do something like the following
If you wanted to make sure you did something for each result you could use the sql.eachRow as well. The documentation is here. Only thing to double check is the name of the entry it returns I’m not sure what it will do since you do production_order.idProdOrder