Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am wondering how I can nest a if then else statement based off of two separate values in the two different columns So a different column would have a True or False Value.
This is a typical If then else string method in java
column1.equals("Home Phone")? "True":"False"
If I wanted to add another column with a distinct value would the syntax be
column2.equals("Fax") && column1.equals("Home Phone")? "True":"False"
I'm in early development of a job and can't run the job yet, so just making sure the syntax is right from the start.
Let me know,
Thanks,
Andrew
@sm In response to your question by PM, the complete syntax should looks like this:
"fax".equalsIgnoreCase(row1.column2) && "home phone".equalsIgnoreCase(row1.column1) ? true : false
This String Expression that's similar to yours only returns False Values currently.
"Do Not Mail".equalsIgnoreCase(row1.mailpref1)&& "Do Not Mail".equalsIgnoreCase(rmailpref2)&& "Do Not Mail".equalsIgnoreCase(mailpref3)? "True" : "False"
If any of these rows contain the "Do Not Mail" value set the value as True else "False"
So not all three values in three seperate columns contains "Do Not Mail" value just one column has to contain "Do Not Mail" value
Maybe you were under the impression that I wanted every column in the string method to have the value "Do Not Mail" not just one.
Please advise
-Andrew
"Do Not Mail".equalsIgnoreCase(row1.mailpref1) || "Do Not Mail".equalsIgnoreCase(rmailpref2) || "Do Not Mail".equalsIgnoreCase(mailpref3)? "True" : "False"
note : True" and true are not same. 1st one is string another is boolean.
Hello @uganesh
If I had some dirty data in the column like addresses how would I add the additional logic to change every value that is not "Yes" to "No"
This is for a different column in the same input data I have a do not contact column.
row1.donotcontact.equals("Yes")? "True": "False"
This returns other data besides "True and "False" including blanks
I meant to change the value to "FALSE" not "No" to clarify