Home › Forums › kdb+ › Using the partition type as a parameter › Reply To: Using the partition type as a parameter
-
The main issue here is changing the .Q.pf (date) value while running the function in scope. Resulting in the error.
Each select query runs, .Q.ps, and while evaluating the where clause, the partition field which is expected to be a list, becomes an atom and (&) fails with type error
When you enlist it, it will work because “where eval c” will always return 1b, which eventually translates into the first partition.
d@:&-6!*c
You can override it to work, if you still want to use it in the function
f:{[date;tab]
c:enlist (=;
date;date);
date:.Q.pv;
?[tab;c;date
sym!
datesym;(enlist
cnt)!enlist (count;`i)]}