Skip to main content

User Defined Functions

SQL Frames allows creating user defined functions and exposing them as Excel-like formula to be used in calculated fields. This allows professional developers to create the formula once but a citizen developer to make use of it as a simple expression without the knowledge of coding.

Defining a UDF

The UDFs can be defined as a library of global functions availabe for all computations. They are typically setup explicitly during the initialization of the application and subsequently used as needed.

Loading...
UDF naming requirement

The UDFs should be using the pattern /[A-Z][A-Z0-9_]+/. That is, first letter is always an uppercase english letter followed by an uppercase letter or 0 to 9 or '_' (underscore) letter.

Like LAMBDA in Excel

For people coming from Excel background, this can be thought of as the LAMBDA function that allows defining user defined functions.

Calling a UDF

Once a UDF is defined, it can be called simply within the calculated field expression as shown below.

Loading...

Nested Functions

The output of built-in or user defined functions can become input to other functions allowing the creation of complex logic.

Loading...

Order of defining

An existing UDF can be redefined by calling the same define function mentioned above. It is even possible to redefine built-in functions. However it is best to avoid such redefinion of functions, especially the built-ins.