How to pass multiple values in tSystem component

Six Stars

How to pass multiple values in tSystem component

I am trying to pass 2 querystring parameters in my Job using tSystem component to launch a JSP page. The page gets launched properly but always i am getting the second parameter as null.

Can you help me in that? See in my screenshot below, i am passing the value as:

"cmd /c start chrome http://localhost:8080/TestDataUpdate?tablename=temp_staging_table&pk=empid"

This gives first parameter as correct, but second parameter is null.

 

tablename.jpgtablename2.jpg

Employee

Re: How to pass multiple values in tSystem component

Encode your url.  It is possible that the & is being interpreted differently in a java script.  Look at URL Encoding when you pass parameters.

Six Stars

Re: How to pass multiple values in tSystem component

Ok. But I am not able to understand how to use  encodeURI in our example.

I think we need to do something like this:

var uri = "my test.asp?name=ståle&car=saab";
var res = encodeURI(uri);

 

How to do it in our case i.e. what would command line look like?

Employee

Re: How to pass multiple values in tSystem component

Hi @ppp_rrr

These are simple developer questions.  It takes less time to google it and find the answer 

https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters

Six Stars

Re: How to pass multiple values in tSystem component

Ya sure @iburtally, it was easy to find on net about encoding, but what I wanted that how to pass it in our URL. i am trying to pass value as:

"cmd /c start chrome " + "URLEncoder.encode(http://localhost:8080/TestDataUpdate?tablename=temp_staging_table&pk=empid, \"UTF-8"\ +")"; "

 

But not getting success, there are errors in it..so I am only seeking help on Syntax..

Employee

Re: How to pass multiple values in tSystem component

"cmd /c start chrome " + URLEncoder.encode("http://localhost:8080/TestDataUpdate?tablename=temp_staging_table&pk=empid", "UTF-8")

Six Stars

Re: How to pass multiple values in tSystem component

Thanks for the reply.

But now I am getting the error that URL encoder cannot be resolved!

encode.jpg

Employee

Re: How to pass multiple values in tSystem component

Prefix the URLEncoder class with its package name

java.net.

Six Stars

Re: How to pass multiple values in tSystem component

This resolves my compiler error and my final string is now:

"cmd /c start chrome " + java.net.URLEncoder.encode("http://localhost:8080/TestDataUpdate?tablename=temp_staging_table&pk=empid", "UTF-8")

 

However, on executing my Job, this only launches 'chrome' and the application hosted doesn't gets launched.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads