2017-04-20 4 views
0

私は、提供までに対応因子列内のエントリを変更しようとしています。アップサート

私はKDBのアップサート機能のために何か良いドキュメントを見つけることができないと私は私がここで間違ってやっているものをゼロアイデアを持っている...

query: {[table;dates;factors] table upsert (date:dates factor:factors);} 
table: `test 
dates: (2016.01.04T01:30:00.000; 2016.01.04T01:31:00.000) 
factors: (0.9340078471263533; 0.9340078471263533) 
query[table; dates; factors] 

date     price original factor askVol  bidVol  
----------------------------------------------------------------------- 
.... 
2017.04.19T07:28:00.000 6.105 6.105 1  2.176407e+07 1.907746e+07 
2017.04.19T07:29:00.000 6.105 6.105 1  2.274138e+07 1.893807e+07 
2017.04.19T07:30:00.000 6.105 6.105 1  2.629207e+07 2.030017e+07 
.... 

An error occurred during execution of the query. 
The server sent the response: 
type 
Studio Hint: Possibly this error refers to wrong type, e.g `a+1 

答えて

1

あなたがテーブルを定義するときは、機能queryの小さな構文エラーがあります入力引数から -

query: {[table;dates;factors] table upsert (date:dates factor:factors);} 

は次のようになります。

query:{[table;dates;factors] table upsert ([] date:dates; factor:factors);} 

テーブル定義の場合は、開封後に[]が追加されます(()。さらに、列の値は、;

+0

で区切る必要があります。ありがとうございました!しかし、私は推論を完全に理解していません。私に参照をリンクすることは可能でしょうか? – jono

+0

([ここ] [ここ](http://code.kx.com/wiki/Reference/Table#Creating_Tables)テーブルを作成するための構文を見るとhttp://code.kx.com/wiki/Startingkdbplus/tables# 4.2_Creating_Tables) – MdSalih

0
q)show table:([] dates:.z.D+til 3;factors:3?.1; something:3?`2) 
    dates  factors something 
    ------------------------------- 
    2017.04.20 0.09441671 hj 
    2017.04.21 0.07833686 lh 
    2017.04.22 0.04099561 mg 
    q)show factormap:(.z.D,.z.D+2)!10000.1 20000.2 
    2017.04.20| 10000.1 
    2017.04.22| 20000.2 
    q)update factors:factors^factormap[dates]from table 
    dates  factors something 
    ------------------------------- 
    2017.04.20 10000.1 hj 
    2017.04.21 0.07833686 lh 
    2017.04.22 20000.2 mg 
    q) 
関連する問題