我有一张这样的桌子:
名称表
姓名 | 包含 |
---|---|
安 | 1 |
鲍勃 | 0 |
猫 | 1 |
我有一个函数可以从包含的内容中获取“位”?栏目:
// get the bits
fGetBits:{[nameTable]
nameTable: select Included from nameTable;
//BitsTable
value flip nameTable}
这将返回以下类型的 0h:
1 0 1
我的问题是如何获取这个 0h 列表并将其添加回 nameTable 表的 Included 列,替换当前值?
例如,如果我有以下内容:
0 1 1
我希望我的桌子现在看起来像这样:
姓名 | 包含 |
---|---|
安 | 0 |
鲍勃 | 1 |
猫 | 1 |
感谢您的帮助。
这个问题有点难以理解,但是:
exec
tableName[columnName]:newListValues
q)nameTable:([] Name:`Ann`Bob`Cat;Included:101b)
q)nameTable
Name Included
-------------
Ann 1
Bob 0
Cat 1
q)exec Included from nameTable
101b
q)type exec Included from nameTable
1h
q)nameTable[`Included]:011b
q)nameTable
Name Included
-------------
Ann 0
Bob 1
Cat 1
q)