User Defined Functions (UDF) is generally written in Graphical Mapping in the mapping editor but with some settings we can even write the same code in NWDS.
Even we can use the input parameters like Container and ResultSet in the local environment as we use it in the standard graphical editor.
This is all possible because of the Impl classes that can be used to replicate the same functionality of classes used in the UDF by standard editors.
Download this Program:[Download not found]
Before heading into this blog, please refer to my previous blogs on:
This guide I am going to show you how to create a standard Java project can be used to write UDF locally and test it before copying it over to graphical mapping.
At the end of the blog, you can download Java UDF Project that is showed in this blog.
Assumption: I assume that you have a working copy of NWDS / eclipse with Java mapping jars with proper Java setup on your local machine. If not, refer to the blogs listed above for help.
UDF in NWDS:
Open Eclipse / NWDS and Select “File -> New -> Java Project“
Create the Project named “UDFLibrary”
Copy the two files ContainerImpl.java and ResultListImpl.java from the downloads
Right Click on the Project and Select Build Path -> Configure Build Path
Now add the Library for UDF
Make sure no errors in the project by now
Create a Class now to write the UDF
Download the UDFLibrary code the downloads below
This is how the project should look it by now
Copy the code and Run as Java Application