Five Stars

Ternary notation help needed...

I am trying to create a variable in the tMap component, which will allow me to test the contents of two input fields from tOracleInput, and output a 1 or 0 based on the result.

I've used a number of variations of notation but none of the,m seem to be giving me the result I expect (and know). Can anyone advised what I need to change in the below:

 

(FirstOfMonth.VEHICLE_DRIVEABLE=="N"&&FirstOfMonth.BOOKING_IN_DATE!=null)?1:0

 

Thanks in advance.

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars TRF
Twelve Stars

Re: Ternary notation help needed...

Hi,

You should never compare 2 strings using the "==" operator:

("N".equals(FirstOfMonth.VEHICLE_DRIVEABLE) && 
 FirstOfMonth.BOOKING_IN_DATE != null) ? 1 : 0

Hope this helps.


TRF
2 REPLIES
Twelve Stars TRF
Twelve Stars

Re: Ternary notation help needed...

Hi,

You should never compare 2 strings using the "==" operator:

("N".equals(FirstOfMonth.VEHICLE_DRIVEABLE) && 
 FirstOfMonth.BOOKING_IN_DATE != null) ? 1 : 0

Hope this helps.


TRF
Five Stars

Re: Ternary notation help needed...

Legend - works a treat.

 

Thanks very much!