Nick Bowles
02/10/2021, 10:31 PM"""
def value = 'blah'
return value
"""
using this syntax:
select groovy('{"returnType":"STRING","isSingleValue":true}', <GROOVY MULTI LINE HERE>, my_variable) as new_variable from table
I have tried to cancel out the quotes, use single, cancel any newlines, and cannot figure out how to get this to work. Any ideas?Neha Pawar
select
groovy(
'{"returnType":"DOUBLE","isSingleValue":true}'
'def sumSales=0;
arg0.eachWithIndex{item, index-> if (item != "mug")
{sumSales = sumSales + arg1[index]}}; return sumSales' ,
p1, p2)
from fooTable
limit 10
here’s a multi line groovy script that used to work for meNick Bowles
02/10/2021, 11:01 PMselect
groovy(
'{"returnType":"STRING","isSingleValue":true}',
'def var=1;
return var') as myvar
from table limit 10
Running this returns the same result of the 200 error code.Neha Pawar
def var="1"
select groovy('{"returnType":"STRING","isSingleValue":true}','def var="1"; return var') from foo limit 10
Nick Bowles
02/10/2021, 11:10 PMNeha Pawar
Nick Bowles
02/10/2021, 11:31 PM