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:
- 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.
Note: This example creates a custom routine to give reverse of a 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; }
- Create a job and drop a tJava component in the designer.
- 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.
- Execute the job to generate the reverse of a string in the example.
Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.
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](https://www.helicaltech.com/wp-content/uploads/2019/01/Quotes.png)
Best Open Source Business Intelligence Software Helical Insight Here
![logo](https://www.helicaltech.com/wp-content/uploads/2019/01/logo.png)
A Business Intelligence Framework
![logo](https://www.helicaltech.com/wp-content/uploads/2019/01/Quotes.png)
Best Open Source Business Intelligence Software Helical Insight is Here
![logo](https://www.helicaltech.com/wp-content/uploads/2019/01/logo.png)