Quick Tips

Quick Tip: Row Multiplication

Sometimes we need to multiply rows based on a column in that row, multiple columns in that row, or by some other factor dependent on the row. In Talend there is a really nice mechanism that allows this to be done quite simply....but it is not very well known about. This QuickTip shows how to use this functionality with a very basic example.

Lets say we have some data which has a numeric column indicating how many times that row should be multiplied.  For example....

Quick Tip: How to debug tMap errors?

We have all been there. You create a job with a tMap and it fails due to some problem in the tMap config. Many times it is due to something connected to data being null. Maybe you have a "compareTo" checking a String that is null or a "parseInt" trying to convert some non-numeric text to an Integer. They are common issues, but they are generally pretty tricky to identify so that you can cater for situations in which they occur. That is if you do not use a trick that is very useful and surprisingly very rarely used.

Quick Tip: Compare row value against a value from the previous row

Sometimes it is useful to be able to compare a column against the same column in a previous row within a dataset. A simple example of this requirement might be as follows. You have a collection of orders that are sorted by Order Number and Date. An Order Number is usually unique, however there can be amendments made. You are tasked with identifying original Orders and Amended Orders. Original Orders will always be the first Order record created.

Quick Tip: Dynamically change DB Connection

I was asked not so long ago how to dynamically change a connection in a Talend Job. I was curious about a use case for this as I hadn't really considered doing this before. The use case was that they had a standard job that they wanted to reuse across all of their environments. "Why not use the Context Variables?" was my response. I was then given the real reason that this is needed. Some of their environments used a SID to connect, others used a Service Name (they were using Oracle). If you look at the tOracleConnection component, you cannot parameterise this.

Quick Tip: Convert an XML String to JSON

While you can create JSON using the tWriteJSONField component, if you want to simply convert an XML String into JSON, there is a much simpler way. 

Quick Tip: Redirect the output from the console to a file

A common question I get when working on client sites is, "How can we save the output from the console without having to copy and paste it?". The console (from Talend DI v6) is shown below.