How to pass a String correctly

Seven Stars

How to pass a String correctly

hi

how can i pass String in active express Builder ?

am doing like this

 

string ques.JPG

 

am not getting any output.

 


Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: How to pass a String correctly

Hi,

You are trying to filter a tMap output flow to keep only rows associated to the input flow "row1" for which DEVICEID is equal to "LAB0115AN3131 " (including the final space.

2 things:

- are you sure about the final space?

- most important, you should never compare 2 strings using the "==" operator but only the "equals" or "equalsIgnoreCase" method like this:

row1.DEVICEID.equals("LAB0115AN3131 ")

(or maybe without the final space).

Hope this help.

 


TRF
Forteen Stars TRF
Forteen Stars

Re: How to pass a String correctly

I suppose there is no filter on the input side.

So, maybe a non editable character into your database field value (?)

Just for testing, can you replace the expression by the following (to ignore the last character):

row1.DeviceId.startsWith("LAB0115AN3131")

TRF

All Replies
Forteen Stars TRF
Forteen Stars

Re: How to pass a String correctly

Hi,

You are trying to filter a tMap output flow to keep only rows associated to the input flow "row1" for which DEVICEID is equal to "LAB0115AN3131 " (including the final space.

2 things:

- are you sure about the final space?

- most important, you should never compare 2 strings using the "==" operator but only the "equals" or "equalsIgnoreCase" method like this:

row1.DEVICEID.equals("LAB0115AN3131 ")

(or maybe without the final space).

Hope this help.

 


TRF
Thirteen Stars

Re: How to pass a String correctly

when it is string field ,use the below expression in active experss Builder.

 

row1.DeviceId.equals("LAB0115ANS3131 ")

 

if you have null data in row1.DeviceId,you may get null pointer exception

for that use below expression.

("LAB0115ANS3131 ").equals(row1.DeviceId)

Manohar B
Forteen Stars TRF
Forteen Stars

Re: How to pass a String correctly

@bksingh, did this help you.

In this case, thank's to mark your cae as solved (Kudo also accepted).


TRF
Seven Stars

Re: How to pass a String correctly

ansreply.JPGtmap.JPG 

am doing this and am not getting any output. Please suggest me something which will helpful for me

Thirteen Stars

Re: How to pass a String correctly

do you have data space like after the end of the value "LAB0115ANS3131 ",if not please remove space.

Manohar B
Thirteen Stars

Re: How to pass a String correctly

can you try with  row1.DeviceId.equals("LAB0115ANS3131") ?

Manohar B
Seven Stars

Re: How to pass a String correctly

am not getting any output . now what i will do ?

 

Forteen Stars TRF
Forteen Stars

Re: How to pass a String correctly

Hi,

As said in my 1rst answer, it seems you have a space at the and of the string used in your expression.

Is it normal?

However, you may also use a tFilterRow in such a case if you just want to exclude rows not matching with your filter.


TRF
Seven Stars

Re: How to pass a String correctly

its normal. when u told me about space am checked and remove space after that run my job. its full scan but not provide any output. the STRING which am used in express builder am copy from database. means that string is exist in my database.

Forteen Stars TRF
Forteen Stars

Re: How to pass a String correctly

I suppose there is no filter on the input side.

So, maybe a non editable character into your database field value (?)

Just for testing, can you replace the expression by the following (to ignore the last character):

row1.DeviceId.startsWith("LAB0115AN3131")

TRF
Seven Stars

Re: How to pass a String correctly

am not getting any row in my database.when am using row1.DeviceID.startsWith("LAB1216AN3012")

am also try row1.DeviceID.contains("LAB1216AN3012"). my output database is empty.

when i will use only mapping not any condition than am getting output.

please kindly help me. 

 

Seven Stars

Re: How to pass a String correctly

where is my fault ? if there is another way please suggest me.

 

Thirteen Stars

Re: How to pass a String correctly

can you check your data,is it have in UPPER case or LOWER case values?

if you have lowercase use ignore case or StringHandling.UPCASE functions.

 

 

LAB1216AN3012 or lab1216an3012

Manohar B
Forteen Stars TRF
Forteen Stars

Re: How to pass a String correctly

Strange.

Replace your database by a file and remove the tMap expression filter then search for the value in the file using your prefered text editor to check that your data arrive as expected.


TRF
Seven Stars

Re: How to pass a String correctly

uppercase or lowercase  no issue.

Thirteen Stars

Re: How to pass a String correctly

no issue means is your issue fixed?

Manohar B
Seven Stars

Re: How to pass a String correctly

lower case and upper case is not issue. my problem is not fixed now.

am also trying different approach due to it am not responding instant. 

when my problem is fixed i will Accept as Solution because i don't want my problem became anybody headache.

Seven Stars

Re: How to pass a String correctly

Dear Folks

Please provide me solution related my post. 

Four Stars

Re: How to pass a String correctly

Can you try 

(row1.DeviceId).equals("LAB0115ANS3131 ")  ?

with braces around the variable.

 

Thirteen Stars

Re: How to pass a String correctly

I belive that your not sure about your data what you have it wil work with row1.DeviceId.equals("LAB0115ANS3131") or row1.DeviceId.startsWith("LAB0115AN3131") or row1.DeviceID.contains("LAB1216AN3012").

 

could you please share sample data in excel ,i will provide you a job export.

Manohar B
Five Stars

Re: How to pass a String correctly

try using single quotes so row1.DeviceID.equals('LAB0115AN3131') or row1.DeviceID = 'LAB0115AN3131'

Thirteen Stars

Re: How to pass a String correctly

i just created a job for you with sample data ,please find the attached job

Manohar B
Seven Stars

Re: How to pass a String correctly

few days ago i have avast antivirus installed in my pc. avast automatically remove my installed Talend Studio. Come in My Topic How to pass String Correctly.
now am using tFileInputExcel for tmap input its working which u all provide me a solution in same case its not working with MicroSoft SQL Server
Seven Stars

Re: How to pass a String correctly

thanks every body now am feeling good and i will start again work with Talend Studio
Five Stars

Re: How to pass a String correctly

I think it has something to do with The map generation of sql scripts and how the columns where created. I noticed when I created columns in oracle sql that when I used quotes it wouldn't work since the tmap query doesn't use quotes to select the columns. I resolved this by creating my columns without quotes using SQL developer. I think you are encountering something similar.