Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Edi1
Contributor
Contributor

if/else

Hello,

Help please!

getting an error in syntax in tMAP

.

"ROA&E".equals(row1.Division_1)?"00000"!=ROA&E:" "

I am trying to say in this code that the output will be "00000" if not equal to ROA&E. Otherwise, it will be the project number. (The output for the project number can be a variation of numbers)

Input data type, I am using String. Output type is a String too.

Thanks-

Labels (2)
10 Replies
gjeremy1617088143

Hi edi :

 

!("ROA&E".equals(row1.Division_1))?"00000":row1.projectNumber

Edi1
Contributor
Contributor
Author

@guenneguez jeremy​ 

 

Thanks!

Errors...

The operator is undefined for the argument type String (! operator)

Also, The row1.Division will output "00000" or a variation of other Project Numbers.

Project Number is not a column row1.Division_1 is a column

 

 

 

 

gjeremy1617088143

!"ROA&E".equals(row1.Division_1)?"00000": here your value when row 1 division equals « ROA&E »

Edi1
Contributor
Contributor
Author

@guenneguez jeremy​ 

Thanks!

It looks to work up to the colon: here your value row 1....

 

Do you know how to allow multiple input here instead of one if it is ROA&E? It will need to output about 3 numbers that are ROA&E.

 

 

Edi1
Contributor
Contributor
Author

I also tried the code below and it output all "00000" so part of the code is missing to get the other outputs that are not "00000"

 

!"ROA&E".equals(row1.Division_1)?"00000":""

gjeremy1617088143

I Edi , please be more precise , you want to use this for multiple columns of your input ?

the better way for that is to use routine instead of code replication.

 

Edi1
Contributor
Contributor
Author

Hi @guenneguez jeremy​ 

 

Thanks. I am trying to be precise with the info. I have.

"00000" if not ROA&E

Project Number if ROA&E

 

The req listed above.

 

The output is to generate "00000" (The code is code for that so far)

or the output will generate 04563

or the output will generate 0B332

or the output will generate 0B572

or the output will generate 0B889

or the output will generate 0B769

 

Project Number is not an input or output schema or value so not to be used in code.

 

 

gjeremy1617088143

How your project number is generate ?

Cause as i can understand now if row1.division = "ROA&E"

you can have différents values for project number, but what are the conditions to differentiate those values ? And where those values come from ?

Edi1
Contributor
Contributor
Author

Hello @guenneguez jeremy​ 

 

Here's the info...

The project number is the same as 00000...and the other numbers...

ROA&E is the variable.

If it is not !ROA&E then equal/populates to "00000"

Else if it is ROA&E equals to one of the other number...It will be/populate || or one of the numbers.