Floor

Available since 15.1 Southside release

Build an expression that applies the floor function to the given expression.

Code

Groovy
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,
            "Floor Costs": Math.floor(row.Costs)
    ]
}

Result

ProductID

Label

Costs

Floor Costs

B-0029

21st Amendment IPA (2006)

46.84

46

B-0072

35 K

41.57

41

B-0090

Alaskan Amber

40.63

40

P-0002

Another Product

150

150

B-0077

Bloody Show

42.26

42

See Also