calling dotnet method using tdotnetrow that takes array as input

One Star

calling dotnet method using tdotnetrow that takes array as input

Hi,
I am trying to call a dotnet dll method, using tdotnetrow component, that takes a string array as an input parameter. But I am getting error something like "<method1> is called with invalid parameters". Do you know if its possible to call a method that takes an array as input parameter?
Thanks,
Mukesh
Moderator

Re: calling dotnet method using tdotnetrow that takes array as input

Hi,
I am getting error something like "<method1> is called with invalid parameters"

Error message is unfortunately too short to provide any answer. More job screenshots will be appreciated.
I provide you with component tdotnetrow reference to help you understand tdotnetrow better.
https://help.talend.com/search/all?query=tDotNETRow&content-lang=en
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: calling dotnet method using tdotnetrow that takes array as input

This is the method signature:
public static void Main(String[] args)
{
Console.Out.WriteLine("Mapping Application");
}
If I pass just one parameter then I am getting following error:
-------------------------------------------------------------------------------------
System.ArgumentException: Object of type 'System.String' cannot be converted to type 'System.String[]'.
at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Java_org_talend_net_Object_invokeStaticGenericNative(JNIEnv_* env, _jclass* _this, _jobject* jAssembly, _jstring* className, _jstring* methodName, _jobjectArray* jParams, _jobjectArray* types, _jobject* nHelper)
------------------------------------------------------------------------------------------------------
If I pass multiple parameter clicking "+" sign then I am getting following error:
-------------------------------------------------------------------------------------------------------------
System.InvalidOperationException: arguments list for call: Main doesn't provide correct number of parameters
at Java_org_talend_net_Object_invokeStaticGenericNative(JNIEnv_* env, _jclass* _this, _jobject* jAssembly, _jstring* className, _jstring* methodName, _jobjectArray* jParams, _jobjectArray* types, _jobject* nHelper)
-------------------------------------------------------------------------------------------------------------
Thanks,
Mukesh
Community Manager

Re: calling dotnet method using tdotnetrow that takes array as input

Hi Mukesh
The method requires only one input parameter and that should be a string array in your case. You can define the input parameter like:
new String[]{input_row.column1}

//column1 is a column name with string type.
In the mean time, i suggest you to read the user manual to know more about this component.:
https://help.talend.com/search/all?query=tDotNETRow&content-lang=en
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business