tDotNETRow
Facilitates data transform by utilizing custom or built-in .NET
classes.
tDotNETRow sends data to and
from libraries and classes within .NET or other custom DLL files.
tDotNETRow Standard properties
These properties are used to configure tDotNETRow running in the Standard Job framework.
The Standard
tDotNETRow component belongs to the DotNET family.
The component in this framework is available in all Talend
products.
Basic settings
Schema and Edit schema |
A schema is a row description, it defines the number of fields to be processed and passed on to the next component. The schema is either built-in or remotely stored in the Repository. |
Built-in: No property data stored centrally. |
|
Repository: Select the Repository file where properties are stored. The following fields are pre-filled in using fetched data |
|
Use a static method | Select this check box to invoke a static method in .NET and this will disable Use an existing instance check box. |
Propagate a data to output | Select this check box to propagate a transformed data to output. |
Use an existing instance | Select this check box to reuse an existing instance of a .NET object from the Existing instance to use list.
Existing instance to use: Select an
existing instance of .NET objects created by the other .NET components from the list. Note: This check box will be disabled if you have
selected Use a static method and selecting this check box will disable Dll to load, Fully qualified class name(i.e. ClassLibrary1.NameSpace2.Class1) and Value(s) to pass to the constructor. |
Dll to load | Type in the path, or browse to the DLL library containing the class(es) of interest or enter the assembly’s name to be used. For example, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 for an OleDb assembly. |
Fully qualified class name(i.e. ClassLibrary1.NameSpace2.Class1) |
Enter a fully qualified name for the class of interest. |
Method name | Fill this field with the name of the method to be invoked in .NET. |
Value(s) to pass to the constructor | Click the plus button to add one or more lines for values to be passed to the constructor for the object. Or, leave this table empty to call a default constructor for the object. The valid value(s) should be the |
Method Parameters | Click the plus button to add one or more lines for parameters to be passed to the method. |
Output value target column | Select a column in the output row from the list to put value into it. |
Advanced settings
Create a new instance at each row | Select this check box to create a new instance at each row that passes through the component. |
Method doesn’t return a value | Select this check box to invoke a method without returning a value as a result of the processing. |
Returns an instance of a .NET Object | Select this check box to return an instance of a .NET object as a result of a invoked method. |
Store the returned value for later use | Select this check box to store the returned value of a method for later reuse in another tDotNETRow component. |
tStatCatcher Statistics | Select this check box to collect log data at the component level. |
Global Variables
Global Variables |
NB_LINE: the number of rows processed. This is an After
ERROR_MESSAGE: the error message generated by the A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see |
Usage
Usage rule | This component is utilized to integrate with .NET objects.
To use this component, you must first install the runtime DLLs, So ensure that the runtime and all of the other Note:
The required DLLs can be installed in the System32 folder or in the bin folder of the |
Integrating .Net into Talend Studio: Introduction
This article describes the way to integrate .Net into Talend Studio, for example,
invoking dll methods in a Talend Studio Job.
Based on the runtime dlls (such as janet-win64.dll), Talend Studio provides the
capability of integrating .NET and Java, through which you can access C++ libraries and
invoke their methods easily in Java. Normally, for a Talend Studio user, this can be
implemented in two ways: utilizing the components in the DotNET family (that is,
tDotNetInstantiate and tDotNetRow) in Talend Studio and custom code. This article
discusses the first method.
In a Talend Studio Job, the tDotNetInstantiate component can be used as a start component
in a flow or an independent subJob. It loads a system assembly or a custom dll by
creating a .NET object. The object can then be used by the subsequent tDotNetRow
components for invoking the methods. You need also to specify the class and set
parameters of the constructor for a tDotNetInstantiate component.
The tDotNetRow component references a .NET object created by a tDotNetInstantiate
component. It can be used mid-flow, start the flow, or end the flow. You need to specify
the method to be invoked and set the parameters for the method. This component also
passes the output of the method to a specified column defined in the schema. So, you
need to add columns in the schema of the component and specify the column which the
output values are passed to.
see Talend Components Reference Guide.
This article shows the way to invoke dll methods in a Talend Studio Job, which uses the two DotNet family
components.
Integrating .Net into Talend Studio: Prerequisites
The prerequisites for invoking dll methods in a Talend Studio Job:
- Obtain the janet dll (that is, janet-win64>.dll): click here for .NET 3.5 or here for .NET 4.0.
- Place the file in a directory that the system variable Path
points to (for example, %JAVA_HOME%in,
C:WindowsSystem32, etc). You can also place it in another
directory. In this case, you need to add the directory as a library path using
-Djava.library.path=path_to_directory_containing_the_dll
. - The system assembly or the dll to integrate already exists.
Integrating .Net into Talend Studio: configuring the Job
Configuring tDotNetInstantiate
In the Basic settings of the tDotNetInstantiate component,
take the following steps.
-
Specifying the dll to load in the DDL to load field. The
DLL can be a system assembly or a custom DLL.For system assemblies, you can specify the name of the desired system
assembly (for example,“System.Data, Version=2.0.0.0,
; for custom
Culture=neutral, PublicKeyToken=b77a5c561934e089”)
dlls, you need to provide the absolute path to the dll (for example,
"C:\WINDOWS\system32\ClassLibrary1.dll)"
. -
Specify the class name and the name space in the Fully qualified
class name field - Set parameter values for the constructor in the Value(s) to pass to the constructor field.
Configuring tDotNetRow
The tDotNetRow component invokes methods of a .Net object created by a
tDotNetInstantiate component and passes the output (if any) to the next component.
This component can also create .Net objects, which can also be reused by subsequent
components.
In the Basic settings of the tDotNetRow component, take the
following steps.
-
Add columns in the schema by clicking the Edit schema
button or using the schema propagated to this component. You need to specify one
of the columns of the schema for holding the output value (if any) using the
Output value target column drop-down list. -
Select Propagate data to output to pass the data from
input to output. -
Take either of the following two options.
- If you have deployed a tDotNetInstantiate component for creating the
.Net object, select Use an existing instance and
select the component from the Existing instance to
use drop-down list to refer the corresponding .Net
object. - You can also create a new .Net object for use. To achieve this, make
sure Use an existing instance is not select, set
DLL to load, Fully qualified class
name, Method Name, and
Value(s) to pass to the constructor options
as needed.
- If you have deployed a tDotNetInstantiate component for creating the
-
Provide the name of the method to invoke in the Method
Name field. -
Provide the parameter values for the method in rows of the Method
Parameters filed. As prompted, you can use input row values as
parameter values (for example, input_row.column_name).Note:- For information about other options of this component, refer to
Talend Components Reference Guide. - See Utilizing .NET in Talend section in Talend Components Reference
Guide for an example of this article.
- For information about other options of this component, refer to
Utilizing .NET in Talend
This scenario describes a three-component Job that uses a DLL library
containing a class called Test1.Class1 Class and invokes a method on it
that processes the value and output the result onto the console.
Prerequisites
Before replicating this scenario, you need first to build up your runtime
environment.
-
Create the DLL to be loaded by tDotNETInstantiate
This example class built into .NET reads as follows:
12345678910111213141516171819202122using System;using System.Collections.Generic;using System.Text;namespace Test1{public class Class1{string s = null;public Class1(string s){this.s = s;}public string getValue(){return "Return Value from Class1: " + s;}}}This class reads the input value and adds the text Return Value from Class1: in front of this value. It is
compiled using the latest .NET. -
Install the runtime DLL from the latest .NET. In this scenario, we use
janet-win32.dll on Windows 32-bit version and place it in the
System32 folder.Thus the runtime DLL is compatible with the DLL to be loaded.
Connecting components
- Drop the following components from the Palette to the design workspace: tDotNETInstantiate, tDotNETRow and tLogRow.
-
Connect tDotNETInstantiate to tDotNETRow using a Trigger
On Subjob OK connection. -
Connect tDotNETRow to tLogRow using a Row
Main connection.
Configuring tDotNETInstantiate
-
Double-click tDotNETInstantiate to
display its Basic settings view and define
the component properties. -
Click the three-dot button next to the Dll to
load field and browse to the DLL file to be loaded.
Alternatively, you can fill the field with an assembly. In this example, we
use :“C:/Program
Files/ClassLibrary1/bin/Debug/ClassLibrary1.dll”” -
Fill the Fully qualified class name field
with a valid class name to be used. In this example, we use:“Test1.Class1” -
Click the plus button beneath the Value(s) to pass
to the constructor table to add a new line for the value to
be passed to the constructor.In this example, we use:"Hello world"
Configuring tDotNETRow
-
Double-click tDotNETRow to display its
Basic settings view and define the
component properties. -
Select Propagate data to output check
box. -
Select Use an existing instance check box
and select tDotNETInstantiate_1 from the
Existing instance to use list on the
right. -
Fill the Method Name field with a method
name to be used. In this example, we use “getValue”, a
custom method. -
Click the three-dot button next to Edit
schema to add one column to the schema.Click the plus button beneath the table to add a new column to the schema
and click OK to save the setting. - Select newColumn from the Output value target column list.
Configuring tLogRow
-
Double-click tLogRow to display its
Basic settings view and define the
component properties. -
Click Sync columns button to retrieve the
schema defined in the preceding component. - Select Table in the Mode area.
Save your Job and press F6 to execute it.
From the result, you can read that the text Return Value from Class1
is added in front of the retrieved value Hello world
.