Ben_R
1
Hi, i have a variable where each item is a table. How can i return a list of their number of rows. For example:
a,b,c,d are tables with # of rows 1,2,9,10 respectively
y: a
bc
d
z: select count i for each table in y
z:1 2 9 10
y join z
a 1
b 2
c 9
d 10
thanks
exec gives you the query result as a list, if you know there will be only one you can run ‘first exec’:
y:{(n:x?100)}each 1 2 9 10
{first exec count i from x}each y
or
a
bc
d!{first exec count i from x}each y
does that help at all?
If the tables are stored in the variable y, then you may use
y!count each value each y
To create a dictionary of the table names and their respective number of rows.
Flying1
4
q)a:([]a:10?10.;b:10?
3)q)b:(a:3?10.;b:3?3)q)c:([]a:12?10.;b:12?
3)q)t:a
bcq)t!(count value@)each ta| 10b| 3c| 12