03/08/2011

Windward Custom Functions: Military payroll calculator

Version 10.1 of the Windward reporting tools introduced equation and functions, similar to what exists in Microsoft Excel. Alongside that came the ability to define custom functions that integrate into both or GUI design tool (AutoTag) and server-deployment servers.

Custom function are a piece of code that allows you implement your own logic in either Java (for the Java engine) or C#/J# (for the .NET engine and AutoTag).

In our case, we want to calculate the salary of someone in the military. For input, we have a payscale code (for example, "O4") and the number of years they've been part of the military (say, 3 years). For output, we have a single number (the salary).

We start with an XML file containing the pay grades, years, and associated salaries (MilitaryPayLookupTable.xml). The step we take below are for Java, but the process is very similar for .NET.

We then take the sample that ships with the Java engine, "JavaCustomFunctionExample."

Open the WindwardCustomFunctions.java file in your IDE or text editor of choice. In the screenshots we use IntelliJ.

Because we are adding a function, change the value of "numberOfFunctions" from 3 to 4.

Add information about the function in the static block.

Implement the function. Windward functions can take the following types as parameters: Object (when you aren't sure what the type will be), Object array (for example "Object vals[]"), and Number. In our case, the implementation is: We are using the rank and years of service to look up the salary in the XML file.

Compile the file and create a JAR called WindwardCustomFunctions.jar.

Replace the WindwardCustomFunctions.jar in your Java engine install with your new one.

We don't provide any other military payroll calculators out of the box with our software.

You would either need to implement your own (using the files linked to in the post above) or you can contact our sales team here for information on a professional services contract to do exactly what you need.