Using Custom Functions With .NET RESTful

The RESTful Report Engine (the Engine) ships with many functions, however, you may find from time to time you require a function customized to your needs that does not exist in our library. The Engine allows you to define your own custom macro functions to expand the Windward reporting functionality.

In this article, we'll work step by step through a custom function example that you can download from here. We'll create a function "LOG(n)", which returns the common logarithm of its argument n.


Starting in Version 21, auto-loading of WindwardCustomFunctions.dll is no longer available you will have to manually activate WindwardCustomFunctions.dll by following the updated instructions below

Create the Custom Function#

Unzip then open the WindwardCustomFunctions.sln in Visual Studio. In the Visual Studio Solution Explorer, select the file WindwardCustomFunctions.cs:

Paste this code after the MULTIPLYALL method in the WindwardCustomFunctions class:

[FunctionDescription("Returns the common logarithm of the inputted parameter")]
public static double LOG(
[ParameterDescription("Take the common logarithm of this inputted number")] double num)
//Note the use of [ParameterDescription(string)] which allows for custom tip information in AutoTag.
return System.Math.Log10(num); //Returns the logarithm of the parameter.

Finally, click on Build, then select Rebuild Solution:

A notification in the Output pane indicates the build was successful. The build produced a DLL called WindwardCustomFunctions.dll.

To find the new WindwardCustomFunctions.dll file, in Solution Explorer right-click on the project, then select Open Folder in File Explorer:

In File Explorer navigate to WindwardCustomFunctions\bin\Debug\, and there is your new WindwardCustomFunctions.dll. Note this location for the custom function installation steps below:

Installing the Custom Function for the RESTful Engine#

  1. In File Explorer navigate to the directory where your WindwardCustomFunctions.dll file is located (as shown above): %USERPROFILE%\Downloads\CSCustomFunctionWalkthrough\WindwardCustomFunctions\bin\Debug
  2. Copy the file WindwardCustomFunctions.dll.
  3. Next navigate to the install directory of the RESTful Engine, by default: C:\inetpub\wwwroot\RESTfulEngine\bin
  4. Paste your WindwardCustomFunctions.dll into this directory.

Starting In Version 21 also follow these steps

  1. Open C:\inetpub\wwwroot\RESTfulEngine\web.config
  2. Add the following under the <WindwardReports> in your web.config file:
<add key="function.files" value="C:\inetpub\wwwroot\RESTfulEngine\bin\WindwardCustomFunctions.dll"/>
  1. Save the web.config

To see how to install the custom functions in our Windward Designer, please follow the instructions here <!---need link to custom function setup in designer --->