Window Join with flexible number of columns

Hi!

I’m doing a window join like that tt: wj[window; `PointID`datetime;tbl; (tbl; (sum; `alpha1); (sum; `alpha2))];

however, i would like it to be more flexible and support a flexible number of alpha,
something like
tt:wj[window; `PointID`datetime; tbl_alpha; (tbl_alpha; {(sum;x)} each `alpha_mean`alpha_mean2)];

which doesnt work
Is there a way to achieve it? Thank you

Your example creates a 2 item list: (table;(aggregation_1;aggregation_2))

(tbl_alpha;((sum;`alpha_mean);(sum;`alpha_mean2)))

But you need a 3 item list: (table;aggregation_1;aggregation_2)

(tbl_alpha;(sum;`alpha_mean);(sum;`alpha_mean2))

enlist the table to place it in a list then join/append your list of aggregations on with , :

tt:wj[window; `PointID`datetime; tbl_alpha; enlist[tbl_alpha],{(sum;x)} each `alpha_mean`alpha_mean2];

Window join | Reference | kdb+ and q documentation - kdb+ and q documentation