我正在尝试根据kdb tick架构从tick函数中对表运行迭代联合联接:
table1:([]time:`timespan$();sym:`symbol$();var1:`float$());
if[not system"t";system"t 1000";
.z.ts:{
table2: ...
table1:table1 uj table2 / throws non descriptive error
`table1 uj table2 / throws type error
}
Run Code Online (Sandbox Code Playgroud)
非描述性错误:
'table1
[0]()
我试图维护一个本地表,该表保留最后500行左右(带有动态列),以便运行进一步的处理。但是我似乎无法从tick函数中更新表。一个人应该如何实现这一功能?谢谢
You are getting 'table1 as an error as it is not defined locally within .z.ts. In kdb if there is local assignment to a specific variable within a function, kdb references that variable locally within the function. In the example of table1 you assign it locally within .z.ts but then attempt to reference table1 which you assigned globally outside of .z.ts. To fix your issue you must assign table1 globally within .z.ts like so table1::table1 uj table2.
table1:([]time:`timespan$();sym:`symbol$();var1:`float$());
if[not system"t";system"t 1000";
.z.ts:{
table2: ...
table1::table1 uj table2
Run Code Online (Sandbox Code Playgroud)