Power

Power

Available since 15.1 Southside release

Builds an expression that will compute the value of the given expression to the power exponent.

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, "Power Costs": Math.pow(row.Costs, 2) ] }

Result

ProductID

Label

Costs

Power Costs

ProductID

Label

Costs

Power Costs

B-0029

21st Amendment IPA (2006)

46.84

2193.986

B-0072

35 K

41.57

1728.065

B-0090

Alaskan Amber

40.63

1650.797

P-0002

Another Product

150

22500

B-0077

Bloody Show

42.26

1785.908

See Also