Why does the FETCH function in the Datefeed Toolbox 2.0 (R2007a) for the Kx database not handle the returned table with primary key?

3 views (last 30 days)
I am trying to use the FECH function to retrieve data from the Kx database. In the retrieved data, the primary key field "date" is not present. I used the following code to retrieve the data:
% A Q server hosting a TAQ database
c = kx('scsettldap09.bankofamerica.com',50007)
% The "by" clause makes "date" be a primary key
% This field is missing from the returned structure
r1 = fetch(c,'select n:count i by date from trade where date>2007.08.01,sym=`FLIR')

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This enhancement has been incorporated in Datafeed Toolbox 3.1 (R2008a). For previous product releases, read below for any possible workarounds:
This ability to include the primary key in the table is currently not available in the Datafeed Toolbox 2.0 (R2007a).
As a possible workaround you can ensure that the required data is not handled as a primary key. The syntax would be as follows:
% "0!" drops the primary key, making it a normal column
% Then the "date" field is present in the output
r2 = fetch(c,'0! select n:count i by date from trade where date>2007.08.01,sym=`FLIR')

More Answers (0)

Products


Release

R2007a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!