how to store function with parameters?

Regular Visitor

I am trying to define a function with parameters. states there are two type of functions:


Stored functions


I can create a ad-hoc function with no problem, but I can't save it as stored function.

For example, ad-hoc function works:

let MyAdd = (x:long , y:long) {
print x + y
MyAdd( 1,2)

But when I save it as a function, I want to save it as 

let MyAdd = (x:long , y:long) {
print x + y

Then I can call it with different x and y, but when I tried to save it, I got error:

"Cannot save an empty function, please select a query in the editor."


Not sure what I am missing here.

suggested I can use ".show function" and ".create function" , but none of them works :









2 Replies

Has anybody every figured this out?  I'm currently running into the same issue.

@JPPage @Jack_Chen Not sure if you got this figured out already. I find that when saving a function you have to put the cursor on the function name in the editor first (presumably because there may be several functions defined there and it wants to know which one you are trying to save).


I do still have problem with calling the query I just saved. It takes a little bit of time to show up under the "functions" tree item (and can later be managed in the Saved Queries section - e.g. deleted) but whenever I try to use it in another query I get an error:


Body of the callable expression cannot be empty


If anybody knows how to fix that please reply. Thanks!