I’ve written the following code to load quote data to a partitionedtable (follow the example from kdb+ for mortals):ldchunk:{.Q.en[:/db;] select code,id,time,datatype,val from flip
codeid
dtime
datatypeval!("IIDTSF";6 10 9 10 3 16) 0: x wheredatatype within
CACB}ldata1:{[fn] d:"D"$ssr[fn;":/HKSE/BidAsk/ba_mb_";""]; / d is the date parsedfrom the filename h1:
sv :
db,($string d),
quote1; /h1 is the file handler of thepartition of that date .Q.fs[{0N!.[h1;();,;ldchunk x]}]
$fn}however, I got a error:{0N!.[h1;();,;ldchunk x]}'h1it seems in .Q.fs[{…}] function call, it cannot recognize ldata1’slocal variable in the embedded function definition.In this case, could anyone tell me how to make this piece of codework?Thanks!
.Q.fs[{0N!.[x;();,;ldchunk y]}h1] `$fn
Thanks! It works for my case.On Feb 14, 4:06?pm, Charles Skelton <char…> wrote:> ?.Q.fs[{0N!.[x;();,;ldchunk y]}h1] $fn>>>>>>>> On Mon, Feb 14, 2011 at 8:24 AM, bovine <chenying...> wrote:> > I've written the following code to load quote data to a partitioned> > table (follow the example from kdb+ for mortals):>> > ldchunk:{.Q.en[
:/db;] select code,id,time,datatype,val from flip> > code
idd
timedatatype
val!(“IIDTSF”;6 10 9 10 3 16) 0: x where> > datatype within CA
CB}>> > ldata1:{[fn]> > ?d:“D”$ssr[fn;“:/HKSE/BidAsk/ba_mb_”;“”]; ?/ d is the date parsed> > from the filename> > ?h1:sv
:db,(
$string d),quote1
; ?/h1 is the file handler of the> > partition of that date> > ?.Q.fs[{0N!.[h1;();,;ldchunk x]}] `$fn> > }>> > however, I got a error:> > {0N!.[h1;();,;ldchunk x]}> > 'h1>> > it seems in .Q.fs[{…}] function call, it cannot recognize ldata1’s> > local variable in the embedded function definition.>> > In this case, could anyone tell me how to make this piece of code> > work?>> > Thanks!>> > –> >
Submitted via Google Groups</chenying…></char…>