Ternary operator in tMap

Four Stars

Ternary operator in tMap

Hi,
Is there somebody to tell me why the following ternary expression doesn't works ?
Var.MNT_DR = (Map_In.SAADBC == "D") ? Map_In.SAAMNT : 0;
As shown on the debugger printsrceen, the field Map_In.SAADBC contains "D" so the test is true and the var.MNT_DR should be updated.
both Var.MNT_DR and Map_In.SAAMNT are float and SAADBC is defined as a String with a lenght of 1.
One Star

Re: Ternary operator in tMap

Hi,
Try this :
Var.MNT_DR = Map_In.SAADBC.equals("D") ? Map_In.SAAMNT : 0.0;
Four Stars

Re: Ternary operator in tMap

That works ! Thanks a lot Maverick