Log

Available since 15.1 Southside release

Builds an expression computing the value of the log (base 10) function applied to the given value.

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,
            "Log Costs": Math.log(row.Costs)
    ]
}

Result

ProductID

Label

Costs

Log Costs

B-0029

21st Amendment IPA (2006)

46.84

3.847

B-0072

35 K

41.57

3.727

B-0090

Alaskan Amber

40.63

3.705

P-0002

Another Product

150

5.011

B-0077

Bloody Show

42.26

3.744

See Also