With window analytic functions, each function is a single class that implements the UserDefinedWindowFunctionAdapter interface (de.rtm.push.adapters.windowfunctions package) from the MashZone NextGen RAQL User Defined Function API.
Window analytic functions, unlike plain functions, have access to all rows, or records within the current partition or window which they can use to perform calculations. Unlike aggregate analytic functions, however, they provide a different calculation for each record.
To accomplish this, window analytic functions use the following methods:
There are also basic 'housekeeping' methods: getParameterTypes() and getReturnType().
You set up your development environment for window analytic functions just the same as for plain functions. See Set Up Your Development Environment for details.
We’re going to use two examples. The first example shows the basics of a window analytics function and how to track state and set the function result. This example implements a simple sum. To create this function, you:
And Configure, Compile, Deploy and Test User-Defined Functions. For the complete code, see Complete WindowSum Example.
The second example implements the MashZone NextGen built-in lead function which illustrates techniques to Work with Specific Records in Window Calculations using the current position of a record.