Ceil
Available since 15.1 Southside release
Build an expression that applies the ceil function to the given expression.
Code
def qapi = api.queryApi()
def t1 = qapi.tables().products()
def products = qapi.source(t1, [t1.sku(), t1.Costs, t1.label()], t1.Costs.greaterThan(40))
.take(5)
.stream { it.collect { it } }
return products.collect { row ->
[
ProductID : row.sku,
Label : row.label,
Costs : row.Costs,
"Ceil Costs": Math.ceil(row.Costs)
]
}Result
ProductID | Label | Costs | Ceil Costs |
|---|---|---|---|
B-0029 | 21st Amendment IPA (2006) | 46.84 | 47 |
B-0072 | 35 K | 41.57 | 42 |
B-0090 | Alaskan Amber | 40.63 | 41 |
P-0002 | Another Product | 150 | 150 |
B-0077 | Bloody Show | 42.26 | 43 |