.create-or-alter function

Creates a stored function or alters an existing function and stores it inside the database metadata.

.create-or-alter function [with (docstring = '<description>', folder='<name>')] [FunctionName] ([paramName:paramType], ...) { CSL-statement }

If the function with the provided FunctionName doesn't exist in the database metadata, the command creates a new function. Else, that function will be changed.

Example

.create-or-alter function  with (docstring = 'Demo function with parameter', folder='MyFolder') TestFunction(myLimit:int)
{
    StormEvents | take myLimit 
} 
Name Parameters Body Folder DocString
TestFunction (myLimit:int) { StormEvents | take myLimit } MyFolder Demo function with parameter