Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I have been using multiple conditions in my tmap to handle two conditions. Below is the logic Im using.
row2.SPRIDEN_ID==null ? "Unknown" :row3.RPRATRM_USER_ID.equals("WWW_USER") ? "N/A" : row2.SPRIDEN_FIRST_NAME
The first condition works and Im able to see Unknown where ever there are nulls in the SPRIDEN_ID but the second condition is not working meaning Im not able to see N/A where ever there is WWW_USER.
Please correct me if Im missing anything in the syntax. I have attached the picture and the one highlighted in yellow should be N/A.
Thank You
The below Java is basically saying "When SPRIDEN_ID is null, set the value to "UNKNOWN". If SPRIDEN_ID is not null AND RPRATRM_USER_ID equals "WWW_USER", set the value to "N/A". Otherwise, set the value to what is held by SPRIDEN_FIRST_NAME"
row2.SPRIDEN_ID==null ? "Unknown" :row3.RPRATRM_USER_ID.equals("WWW_USER") ? "N/A" : row2.SPRIDEN_FIRST_NAME
So, I suspect that in your example, that SPRIDEN_ID is null when RPRATRM_USER_ID is "WWW_USER"
Thanks for the reply. As you suspected, SPRIDEN_ID is not null when RPRATRM_USER_ID is "WWW_USER".
But I changes the expression as below and that worked. Now im able to see N/A for the WWW_USER
row3.RPRATRM_USER_ID.equals("WWW_USER") ? "N/A" : row2.SPRIDEN_ID == null ? "Unknown" : row2.SPRIDEN_FIRST_NAME
That is interesting. Are you sure SPRIDEN_ID was not null? The code you used could not have returned that value unless it was null.
The change that you have made simply changes the order in which the logic is applied. The first test is "Does RPRATRM_USER_ID equal 'WWW_USER'?". If that part of the code is true, it doesn't bother to check the rest since it knows what to do at that point. It's only if it does not match "WWW_USER" that the next condition is checked.
Sorry looks like I was not clear with the info I gave you. Below is the logic.
if RPRATRM_USER_ID is WWW_USER then "N/A"
I mean to say if RPRATRM_USER_ID is WWW_USER then no need to worry about the SPRIDEN_ID, we need to just print it as N/A.