Im trying to have a function where the output becomes the input of the next iteration. I pass in the table called tab, and want to pass each threshold.
Here is the func:
test:{[data;t]
data:update check:t`t3 from data where id within (t`t1;t`t2)
}/[tab;]threshold
Data:
tab:([]id:12 130 44 46 456;side:`S`S`B`S`B;entityVal:123 123 456 456 456;eventType:`New`Filled`New`Partial`Partial)
threshold:([]t1:100 10 39 60 80 100 ;t2:200 20 49 70 90 150;t3:`test1`test2`test3`tes4`tes5`test6);
Can anyone advise what is the issue with the function? Its currently giving a rank: Invalid rank or valence (parameter count) error.
Im trying to have a function where the output becomes the input of the next iteration. I pass in the table called tab, and want to pass each threshold.
Here is the func:
test:{[data;t]
data:update check:t`t3 from data where id within (t`t1;t`t2)
}/[tab;]threshold
Data:
tab:([]id:12 130 44 46 456;side:`S`S`B`S`B;entityVal:123 123 456 456 456;eventType:`New`Filled`New`Partial`Partial)
threshold:([]t1:100 10 39 60 80 100 ;t2:200 20 49 70 90 150;t3:`test1`test2`test3`tes4`tes5`test6);
Can anyone advise what is the issue with the function? Its currently giving a rank: Invalid rank or valence (parameter count) error.
Share Improve this question edited Mar 4 at 15:48 kka asked Mar 4 at 15:39 kkakka 253 bronze badges1 Answer
Reset to default 1Your syntax runs without error in my console.
q)f:{[data;t] data:update check:t`t3 from data where id within (t`t1;t`t2)}
/
- https://code.kx/q/ref/accumulators/#unary-application
q)tab f/threshold
id side entityVal eventType check
----------------------------------
12 S 123 New test2
130 S 123 Filled test6
44 B 456 New test3
46 S 456 Partial test3
456 B 456 Partial
/Same as
q)f/[tab;] threshold
id side entityVal eventType check
----------------------------------
12 S 123 New test2
130 S 123 Filled test6
44 B 456 New test3
46 S 456 Partial test3
456 B 456 Partial
over
- https://code.kx/q/ref/over/
q)f over enlist[tab],threshold
id side entityVal eventType check
----------------------------------
12 S 123 New test2
130 S 123 Filled test6
44 B 456 New test3
46 S 456 Partial test3
456 B 456 Partial