Iterate saving down a table

Hi, I’m trying to save down a date partitioned table to disk. Using the .Q.dpft[':/path/to/location;.z.d;'sym;‘tablename]. This woks fine. I want to do this multiple times at end of day to the various tables that exist., and so I’d like to enclose this in a function, and pass the table name(s)in iteratively, saving down each one, one at a time. But how do I do this given I won’t be writing the explicit name of the table for the last parameter, rather the local parameters name, so I think this doesn’t work. Eg savedata:{[tab;dt] .Q.dpft[’/home/dir/hdb;dt;'sym;'tab];} savedata[t;.z.d-1]. //t is table saved in memory. Regard, John

Hi John,

dpft expects 4 params, so pass 3 variables and then run on each the 4th param(tnames).

Furthermore, the 4th param is table name, not table data,ie. `tab not tab, and I guess this is where you are seeing errors. 

http://code.kx.com/wiki/DotQ/DotQDotdpft

q)t2:t:(a:10?10;b:10?`2)

q).Q.dpft[:./;.z.d;b]each tt2

or

q).Q.dpft[:./;.z.d;b]each tables    // if you want to save down all tables that are in memory at that time. 

HTH,

Sean