Search code examples
listkdbq-lang

Finding position of key in list column of a table


I have a table with one of columns keyname being int and another column keylist being list of int. I am trying to create another column which is position of keyname in keylist in my table in following manner:

update keypos:{y?x} . (keyname;keylist) from tableName

OR

update keypos:{{x?1}(y=x)} . (keyname;keylist) from tableName

Both of these result in keypos with value=size of table.

Any insights much appreciated.


Solution

  • update keypos:keylist?'keyname from tableName