I need to create a new field to indicate BUY, New BUY or Sell, New SELL depending on the fields ordtype and liq . eg. if ordtype = 1 AND liq>0 then "buy" else if ordtype = 1 ANd liq = 0 then "new buy"if ordtype = 2 And liq >0 then = "sell" else if ordtype 2 ANd liq =0 then = "new sell ". how do this during mapping?
Hi
The expression look like:
row1.ordtype==1&&row1.liq>0?"buy"
row1.ordtype==1&&row1.liq==0?"new buy"
row1.ordtype==2&&row1.liq>0?"sell":"new sell"))
Best regards
Shong
oh i got this error Exception in thread "main" java.lang.Error: java.lang.Error: java.lang.Error: Unresolved compilation problems: Incompatible operand types String and int Incompatible operand types String and int Incompatible operand types String and int
i think i because ordtyp is a string and liq is a int
Then modify shong's expression to:
row1.ordtype.equals("1")&&row1.liq>0?"buy"
row1.ordtype.equals("1")&&row1.liq==0?"new buy"
row1.ordtype.equals("2")&&row1.liq>0?"sell":"new sell"))
although I would use the expression:
(row1.liq==0?"new ":"")+(row1.ordtype.equals("1")?"buy":"sell")