nilesh: ("ISSS"; enlist ",") 0: `nileshdata.csv; show nilesh / specification: for each column there will be a preference / sequence. eventclientpref: `a`b`c eventcomppref: `b`c`a / For each orderid, want the non-null client corresponding / to the hightest eventclientpref. / Separately want the non-null compid correspondeing / to the hightest eventcomppref. preffinder:{[prefarray; eventarray; arr] i: min prefarray ?/: eventarray[where not arr = `]; / 5 + `x; :arr[where eventarray = prefarray[i]] } tmp: select myclientid: preffinder[eventclientpref; event; clientid], mycompid: preffinder[eventcomppref; event; compid] by orderid from nilesh