We have a table t:
t:([] sym:`GOOG`IBM`APPL; px:10 20 30; size:1000 2000 3000)
Now we want to select assign a column in output based on a condition provided in a function.
{[m]select sym, px, size, eb:?[`ab=m;`cd;`ef] from t where size>1000}[`ab] / This works fine providing proper value to eb in output(if/else)
But my requirement is based on (if/else if) to set the value of eb as below, tried ?, $ but didn't work
{[m]select sym, px, size, eb:?[`ab=m;`cd;`yz=m;`ef] from t where size>1000}[`ab] / It fails with type error
requirement(Sudo code):
if (m==ab) { return cd};
else if (m==yz) {return ef};