How to Create Custom Routines in Talend Open Studio

Posted on by By admin, in Talend | 0

Talend provides a large number of components which handles most of the requirements to get the ETL job done. But sometimes, we come across requirements where it becomes very essential to write a custom code so as to use it throughout the job several times. This is where custom routines come in handy to get the job done.

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

This blog gives a walkthrough of how to create custom routines and how to use the custom routines in the Talend job.

  • Create a custom routine in talend:
  • Note: This example creates a custom routine to give reverse of a string.

    • In the repository, right click on Routines. We can either create a routine or create a folder where routines are to be created.
    • Click on Create Routine and enter the name of the routine to be created
    • A routine with the name specified is created which by default creates a class with the routine name.
    • Modify the default code generated according to the requirement. In our example, we have modified the code to return the reverse of the input string.
    • Code:

      public static String reverse(String string) {
          	String reverse = "";
              int length = string.length();
              for(int i=length-1;i>=0;i--)
              	reverse = reverse+string.charAt(i);
              return reverse;
          }
      

    • Save the modified routine, and the custom routine for generating the reverse of a string is ready to be used.
  • Use the custom routine in the job :
    • Create a job and drop a tJava component in the designer.
    • Make data easy with Helical Insight.
      Helical Insight is the world’s best open source business intelligence tool.

    • Type routines and press CTRL+SPACE to find the custom routine class created.
    • Click on routine name and press CTRL+SPACE to find the custom routine function created in the class.

    • Example :

    • Execute the job to generate the reverse of a string in the example.


This routine can be reused in any job created in different components.

Example: In tMap, the routine can be seen as

The description of the routine can also be modified to view the functionality of the routine created.


This description of the functionality of the routine can be seen in the display of the user defines routine.

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

In case if you have any queries please get us at support@helicaltech.com

Thank You
G R Rajitha
Helical IT Solutions Pvt Ltd

logo

Best Open Source Business Intelligence Software Helical Insight Here

logo

A Business Intelligence Framework


logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments