.create-or-alter function

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

Rules for parameter types and CSL statements are the same as for let statements.

Syntax

.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.

Input

Input parameter Type Description
docstring String A description of the function.
folder String The name of the folder tag.
FunctionName(ParamName:ParamType) String (String:datatype) Name of the function, the parameter name and datatype.

Example

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

Results

Name Parameters Body Folder DocString
TestFunction (myLimit:int) { StormEvents | take myLimit } MyFolder Demo function with parameter