0

I am trying to load the data for each date and then sort the sym column and apply the parted attribute. But I don’t know how to use the .Q.dpft function to save to the same table?

There is a trade table in hdb. Here is my function:

\l dbdir;
test:{
    trade:select from trade where date = x;
    trade:`sym xasc trade;
    .Q.dpft[dbdir;x;`sym;`trade]}each date;

Doesn’t seem to be working though. The error is ``trade`

Cathal O'Neill
  • 2,522
  • 1
  • 6
  • 17
Terry
  • 523
  • 9
  • 21

1 Answers1

2

I think you need to pass the table trade & dbdir as arguments to your function since you're referencing them inside the function.

test:{[dbdir;table;x]
  trade:select from table where date = x;
  .Q.dpft[dbdir;x;`sym;table]}[dbdir;`trade]each date

Also perhaps worth noting that .Q.dpft will take care of sorting the sym column for you, so no need to sort it separately.

Cathal O'Neill
  • 2,522
  • 1
  • 6
  • 17