Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
prabuj
Contributor III
Contributor III

how to achieve a series of conditions in column with Talend ?

Dear Team,

@Richard Hall @Shicong Hong @Customer Helpline

The input file is csv. I would like to achieve this certain condition in Talend,

If this number come in the data of a column , it should result in the output as "ACTIVE" & "INACTIVE"

1,2,5,6,B,F = " ACTIVE"

3,4,7,8,9,A,C,D, E,Z = " INACTIVE"

Thanks in advance. Please advice us with clear example.

Labels (2)
1 Solution

Accepted Solutions
prabuj
Contributor III
Contributor III
Author

@Aiming Chen​ 

 

Your answer works brilliantly !! * only when the data fixed with the numbers I specify. But I get sequence of numbers which I need to make active and inactive for those specific numbers alone, rest need to be collected as it is.

 

But what if I get a value 10, in that case , it gives a wrong data like inactive for it.

 

I use the treplace component to specify for the numbers with the ACTIVE & INACTIVE , so I can collect the rest of data as well.

 

for ex:

 

Name Code

Prabuj ACTIVE ( 1)

KEVIN ACTIVE (2)

ARANYA INACTIVE (7)

JACK 10

 

Thank you so much for the code between, it help for the other requirement.

 

 

 

 

 

 

View solution in original post

4 Replies
Anonymous
Not applicable

Hello @Prabhakaran Rajendran​ ,

can you try the below expression if it match your requirement?

input_row.contains("B") || input_row.contains("F")? "ACTIVE": "INACTIVE"

 

if it doesn't help, please provide more details about requirements, thanks

Anonymous
Not applicable

The input data must be one of the value of the list "1,2,5,6,B,F,3,4,7,8,9,A,C,D, E,Z" or it could be any a value including empty value and null?

 

 

prabuj
Contributor III
Contributor III
Author

@Aiming Chen​ 

 

Your answer works brilliantly !! * only when the data fixed with the numbers I specify. But I get sequence of numbers which I need to make active and inactive for those specific numbers alone, rest need to be collected as it is.

 

But what if I get a value 10, in that case , it gives a wrong data like inactive for it.

 

I use the treplace component to specify for the numbers with the ACTIVE & INACTIVE , so I can collect the rest of data as well.

 

for ex:

 

Name Code

Prabuj ACTIVE ( 1)

KEVIN ACTIVE (2)

ARANYA INACTIVE (7)

JACK 10

 

Thank you so much for the code between, it help for the other requirement.

 

 

 

 

 

 

prabuj
Contributor III
Contributor III
Author

@Shicong Hong​ it could have the empty value and other numbers as well. So I use the treplace components to specify the list of "ACTIVE" & "INACTIVE" , and collect the rest.

 

Solved !

 

Thank you so much for the efforts.