May 27 2019
09:52 AM
- last edited on
Apr 07 2022
05:48 PM
by
TechCommunityAP
May 27 2019
09:52 AM
- last edited on
Apr 07 2022
05:48 PM
by
TechCommunityAP
I am trying to define a function with parameters.
https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions states there are two type of functions:
ad-hoc
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.
https://docs.microsoft.com/en-us/azure/kusto/management/functions
suggested I can use ".show function" and ".create function" , but none of them works :
Oct 29 2019 12:59 PM
Has anybody every figured this out? I'm currently running into the same issue.
Dec 24 2019 10:03 AM
@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!