Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
jkrfs
Creator
Creator

[resolved] tJavaRow and ternary operator?

Greetings, I need to check for a specific string in a column before I allow another column pass through its value, if not I want to make it 0.
For example, I have two columns (A, B) with two rows.
# A B
1 100 C
2 50 M
Column A is a Big Decimal and column B is a String. I run the flow through a tJavaRow and I use the condition:
output_row.ColumnA = input_row.ColumnB.equals("C") ? input_row.ColumnA : 0;
So after tJavaRow, the results look like
# A B
1 100 C
2 0 M
However, I am getting this error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from Number&Comparable<?> to BigDecimal
Is there something wrong with my Java? Or is this not allowed in Talend?
Thank you!
Labels (3)
1 Solution

Accepted Solutions
jkrfs
Creator
Creator
Author

The java was wrong, I got it fixed:
output_row.ColumnA = input_row.ColumnB.equals("C") ? input_row.ColumnA : new BigDecimal(0);

View solution in original post

1 Reply
jkrfs
Creator
Creator
Author

The java was wrong, I got it fixed:
output_row.ColumnA = input_row.ColumnB.equals("C") ? input_row.ColumnA : new BigDecimal(0);